diff options
author | Dan Lipsa <dan.lipsa@kitware.com> | 2024-06-27 14:44:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 11:44:36 -0700 |
commit | 4c7d18a77207a7c2dd9fcb9a23e86ec7cff2c6ab (patch) | |
tree | c1ab0b64b7b2c9dcf0687cb919d593e9ce41569f /bin/spack.bat | |
parent | b28b26c39ad7cfbf990fb63005974a86495edcd5 (diff) | |
download | spack-4c7d18a77207a7c2dd9fcb9a23e86ec7cff2c6ab.tar.gz spack-4c7d18a77207a7c2dd9fcb9a23e86ec7cff2c6ab.tar.bz2 spack-4c7d18a77207a7c2dd9fcb9a23e86ec7cff2c6ab.tar.xz spack-4c7d18a77207a7c2dd9fcb9a23e86ec7cff2c6ab.zip |
Spack on Windows: fix "spack load --list" and "spack unload" (#35720)
Fix the following on Windows:
* `spack load --list` (this printed 0 packages even if packages were
loaded)
* `spack unload <package>` (this said that the package is not loaded
even if it was)
Update unit tests for `spack load` to also run on Windows (specifically
for ".bat"). This involved refactoring a few tests to parameterize
based on whether the unit tests are being run on a Windows system
(and to account for batch syntax).
Diffstat (limited to 'bin/spack.bat')
-rw-r--r-- | bin/spack.bat | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bin/spack.bat b/bin/spack.bat index 8328013599..a5a5384e9f 100644 --- a/bin/spack.bat +++ b/bin/spack.bat @@ -188,25 +188,27 @@ if NOT "%_sp_args%"=="%_sp_args:--help=%" ( goto :end_switch :case_load -:: If args contain --sh, --csh, or -h/--help: just execute. -if defined _sp_args ( - if NOT "%_sp_args%"=="%_sp_args:--help=%" ( - goto :default_case - ) else if NOT "%_sp_args%"=="%_sp_args:-h=%" ( - goto :default_case - ) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" ( - goto :default_case - ) +if NOT defined _sp_args ( + exit /B 0 +) + +:: If args contain --bat, or -h/--help: just execute. +if NOT "%_sp_args%"=="%_sp_args:--help=%" ( + goto :default_case +) else if NOT "%_sp_args%"=="%_sp_args:-h=%" ( + goto :default_case +) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" ( + goto :default_case +) else if NOT "%_sp_args%"=="%_sp_args:--list=%" ( + goto :default_case ) for /f "tokens=* USEBACKQ" %%I in ( - `python "%spack%" %_sp_flags% %_sp_subcommand% --bat %_sp_args%`) do %%I + `python "%spack%" %_sp_flags% %_sp_subcommand% --bat %_sp_args%` + ) do %%I goto :end_switch -:case_unload -goto :case_load - :default_case python "%spack%" %_sp_flags% %_sp_subcommand% %_sp_args% goto :end_switch |