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:
John W. Parent
2023-06-27 21:26:51 -04:00
committed by GitHub
parent 25cc734452
commit 78f33bc002
11 changed files with 197 additions and 15 deletions

View File

@@ -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 **************************"

View File

@@ -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