fix for the shell arg handling issues
The setup-env.sh script now saves off the argument array before shifting off all the arguments so that the final command invocation doesn't arbitrarily requote the arguments. All external quoting is preserved now. This has been thoroughly tested with zsh, but should probably be tested with bash etc. before acceptance.
This commit is contained in:
parent
dd21a01dc4
commit
3ce99cf4e1
1 changed files with 7 additions and 1 deletions
|
@ -56,6 +56,12 @@
|
||||||
# spack dotfiles.
|
# spack dotfiles.
|
||||||
########################################################################
|
########################################################################
|
||||||
function spack {
|
function spack {
|
||||||
|
# save raw arguments into an array before butchering them
|
||||||
|
args=()
|
||||||
|
for a in "$@"; do
|
||||||
|
# yup, this is awful, blame bash2 compat
|
||||||
|
args=("${args[@]}" "$a")
|
||||||
|
done
|
||||||
# accumulate initial flags for main spack command
|
# accumulate initial flags for main spack command
|
||||||
_sp_flags=""
|
_sp_flags=""
|
||||||
while [[ "$1" =~ ^- ]]; do
|
while [[ "$1" =~ ^- ]]; do
|
||||||
|
@ -116,7 +122,7 @@ function spack {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
command spack $_sp_flags $_sp_subcommand $_sp_spec
|
command spack "${args[@]}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue