mirror of
https://github.com/PowerShell/PSReadLine
synced 2026-06-08 12:12:13 +00:00
Don't save history if HOME not set
This commit is contained in:
+17
-7
@@ -182,13 +182,23 @@ namespace Microsoft.PowerShell
|
||||
else
|
||||
{
|
||||
// History is data, so it goes into .local/share/powershell folder
|
||||
HistorySavePath = System.IO.Path.Combine(
|
||||
Environment.GetEnvironmentVariable("HOME"),
|
||||
".local",
|
||||
"share",
|
||||
"powershell",
|
||||
"PSReadLine",
|
||||
historyFileName);
|
||||
var home = Environment.GetEnvironmentVariable("HOME");
|
||||
|
||||
if (!String.IsNullOrEmpty(home))
|
||||
{
|
||||
HistorySavePath = System.IO.Path.Combine(
|
||||
home,
|
||||
".local",
|
||||
"share",
|
||||
"powershell",
|
||||
"PSReadLine",
|
||||
historyFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No HOME, then don't save anything
|
||||
HistorySavePath = "/dev/null";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user