mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-16 14:41:02 +02:00
users/26406: preserve caller setopts in zargs
This commit is contained in:
parent
6e20f0e3d1
commit
b374f7b318
2 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2021-01-23 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* users/26406: Functions/Misc/zargs: preserve caller setopts
|
||||||
|
|
||||||
2021-01-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
2021-01-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||||
|
|
||||||
* 47849: Test/E01options.ztst, Test/V08zpty.ztst,
|
* 47849: Test/E01options.ztst, Test/V08zpty.ztst,
|
||||||
|
|
|
@ -70,6 +70,19 @@
|
||||||
# this behavior, as do -l/-L, but when -i/-I appear anywhere then -l/-L
|
# this behavior, as do -l/-L, but when -i/-I appear anywhere then -l/-L
|
||||||
# are ignored (forced to 1).
|
# are ignored (forced to 1).
|
||||||
|
|
||||||
|
# First, capture the current setopts as "sticky emulation"
|
||||||
|
if zmodload zsh/parameter
|
||||||
|
then
|
||||||
|
emulate $(emulate -l) -c "\
|
||||||
|
_zarun() {
|
||||||
|
options=( ${(j: :kv)options[@]} monitor off zle off )"'
|
||||||
|
eval "$@"
|
||||||
|
}'
|
||||||
|
else
|
||||||
|
# Warning?
|
||||||
|
emulate $(emulate -l) -c '_zarun() { eval "$@" }'
|
||||||
|
fi
|
||||||
|
|
||||||
emulate -L zsh || return 1
|
emulate -L zsh || return 1
|
||||||
local -a opts eof n s l P i
|
local -a opts eof n s l P i
|
||||||
|
|
||||||
|
@ -186,8 +199,8 @@ local execute='
|
||||||
elif (( $opts[(I)-(-verbose|t)] ))
|
elif (( $opts[(I)-(-verbose|t)] ))
|
||||||
then print -u2 -r -- "$call"
|
then print -u2 -r -- "$call"
|
||||||
fi
|
fi
|
||||||
eval "{
|
_zarun "{
|
||||||
\"\${(@)call}\"
|
\"\${call[@]}\"
|
||||||
} $bg"'
|
} $bg"'
|
||||||
local ret=0 analyze='
|
local ret=0 analyze='
|
||||||
case $? in
|
case $? in
|
||||||
|
|
Loading…
Reference in a new issue