Escape * in build-debug before passing to debug
With `setopt nonomatch` unescaped `*` can be used in command arguments however when passing command arguments to `build-debug` the `*` _should_ be escaped so that the debugger e.g. `gdb` will correctly invoke the program where `setopt nonomatch` does not apply.
This commit is contained in:
parent
6bd2b8f0cc
commit
dff42f5125
@ -165,11 +165,18 @@ EOF
|
||||
# Build then run a target residing in `~build/bin`.
|
||||
build-run() {
|
||||
local target=$1; shift 1
|
||||
eval build $target && ~build/bin/$target $*
|
||||
eval build $target && ~build/bin/$target "$@"
|
||||
}
|
||||
|
||||
# Build then debug a target residing in `~build/bin`.
|
||||
build-debug() {
|
||||
local target=$1; shift 1
|
||||
eval build $target && debug ~build/bin/$target $*
|
||||
# For each item in $* replace * and \* and then replace \ with \\
|
||||
autoload -U regexp-replace
|
||||
local args=()
|
||||
for arg in "$@"; do
|
||||
regexp-replace arg '\*' '\\*'
|
||||
args+=($arg)
|
||||
done
|
||||
eval build $target && debug ~build/bin/$target $args
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user