diff options
author | John W. Parent <45471568+johnwparent@users.noreply.github.com> | 2023-06-27 21:26:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-27 18:26:51 -0700 |
commit | 78f33bc002816dd690047a7a38077b6ac6617d44 (patch) | |
tree | d90f8290c6c5ef2e5f3af69e1373ec4cf318522f /share | |
parent | 25cc7344526f76df1e2c8d7eb0748bccbb8ace63 (diff) | |
download | spack-78f33bc002816dd690047a7a38077b6ac6617d44.tar.gz spack-78f33bc002816dd690047a7a38077b6ac6617d44.tar.bz2 spack-78f33bc002816dd690047a7a38077b6ac6617d44.tar.xz spack-78f33bc002816dd690047a7a38077b6ac6617d44.zip |
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).
Diffstat (limited to 'share')
-rw-r--r-- | share/spack/setup-env.ps1 | 4 | ||||
-rwxr-xr-x | share/spack/spack-completion.bash | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/share/spack/setup-env.ps1 b/share/spack/setup-env.ps1 index edf9613ec5..d3bed93d9b 100644 --- a/share/spack/setup-env.ps1 +++ b/share/spack/setup-env.ps1 @@ -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 **************************" diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index abf41cb052..2e98698e0f 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -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 |