From 16489685141dc991806c49c85453bcd6310a9f51 Mon Sep 17 00:00:00 2001 From: Dan Lipsa Date: Tue, 7 Feb 2023 14:04:14 -0500 Subject: [PATCH] Windows: Fix spack.bat handling of env commands (#35143) This PR enables the successful execution of the spack binary cache tutorial on Windows. It assumes gnupg and file are available (they can be installed with choco). * Fix handling of args with quotes in spack.bat * `file` utility can be installed on Windows (e.g. with choco): update error message accordingly --- bin/spack.bat | 48 +++++++++++++++++++------------ lib/spack/llnl/util/filesystem.py | 16 +++++------ 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/bin/spack.bat b/bin/spack.bat index 495b61a794..073f778c34 100644 --- a/bin/spack.bat +++ b/bin/spack.bat @@ -83,6 +83,16 @@ if defined _sp_flags ( exit /B 0 ) ) +if not defined _sp_subcommand ( + if not defined _sp_args ( + if not defined _sp_flags ( + python "%spack%" --help + exit /B 0 + ) + ) +) + + :: pass parsed variables outside of local scope. Need to do :: this because delayedexpansion can only be set by setlocal echo %_sp_flags%>flags @@ -92,24 +102,24 @@ endlocal set /p _sp_subcommand=