From c5179fbaf58feeab5cc1607b124cc02aec11e623 Mon Sep 17 00:00:00 2001 From: Luke Sampson Date: Wed, 4 Sep 2013 11:32:44 +1000 Subject: [PATCH] edge case for MSYS shims running as system (don't try to set $HOME) --- lib/core.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core.ps1 b/lib/core.ps1 index 8201eb2a..a952b9a1 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -89,6 +89,7 @@ function shim($path, $global) { # note: use > for first line to replace file, then >> to append following lines echo '# ensure $HOME is set for MSYS programs' > $shim echo "if(!`$env:home) { `$env:home = `"`$home\`" }" >> $shim + echo 'if($env:home -eq "\") { $env:home = $null } # running as system' >> $shim echo "`$path = '$path'" >> $shim echo 'if($myinvocation.expectingInput) { $input | & $path @args } else { & $path @args }' >> $shim @@ -97,6 +98,7 @@ function shim($path, $global) { $shim_cmd = "$(strip_ext($shim)).cmd" ':: ensure $HOME is set for MSYS programs' | out-file $shim_cmd -encoding oem '@if "%home%"=="" set home="%homedrive%%homepath%\"' | out-file $shim_cmd -encoding oem -append + '@if %home%=="/" set home= &:: (running as system)' | out-file $shim_cmd -encoding oem -append "@`"$path`" %*" | out-file $shim_cmd -encoding oem -append } }