Windows: Add PowerShell env support (#37951)
PowerShell requires explicit shell and env support in Spack. This is due to the distinct differences in shell interactions between cmd and pwsh. Add a doskey in pwsh piping 'spack' commands to a powershell script similar to the sh function 'spack'. Add support for PowerShell-specific shell interactions from Spack (set/unset shell variables).
This commit is contained in:
@@ -46,6 +46,10 @@ if ($null -eq $Env:EDITOR)
|
||||
$Env:EDITOR = "notepad"
|
||||
}
|
||||
|
||||
# Set spack shell so we can detect powershell context
|
||||
$Env:SPACK_SHELL="pwsh"
|
||||
|
||||
doskey /exename=powershell.exe spack=$Env:SPACK_ROOT\bin\spack.ps1 $args
|
||||
|
||||
Write-Output "*****************************************************************"
|
||||
Write-Output "**************** Spack Package Manager **************************"
|
||||
|
@@ -935,7 +935,7 @@ _spack_env() {
|
||||
_spack_env_activate() {
|
||||
if $list_options
|
||||
then
|
||||
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat -v --with-view -V --without-view -p --prompt --temp -d --dir"
|
||||
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh -v --with-view -V --without-view -p --prompt --temp -d --dir"
|
||||
else
|
||||
_environments
|
||||
fi
|
||||
|
Reference in New Issue
Block a user