mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-06-01 12:56:04 +02:00
25532: problem skipping assignments etc. with setopt ERREXIT
This commit is contained in:
parent
9d7298bac8
commit
b8ae885ab8
|
@ -1,3 +1,9 @@
|
|||
2008-08-25 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 25532, Src/exec.c, Test/C03traps.ztst: skipping next command
|
||||
didn't work if it was an assignment or other form tagged as
|
||||
"simple".
|
||||
|
||||
2008-08-24 Clint Adams <clint@zsh.org>
|
||||
|
||||
* 25521: Completion/Unix/Command/_git: get merge strategies from
|
||||
|
|
|
@ -1068,7 +1068,7 @@ execlist(Estate state, int dont_change_job, int exiting)
|
|||
lineno = lnp1 - 1;
|
||||
}
|
||||
|
||||
if (sigtrapped[SIGDEBUG] && isset(DEBUGBEFORECMD)) {
|
||||
if (sigtrapped[SIGDEBUG] && isset(DEBUGBEFORECMD) && !intrap) {
|
||||
int oerrexit_opt = opts[ERREXIT];
|
||||
opts[ERREXIT] = 0;
|
||||
noerrexit = 1;
|
||||
|
@ -1086,11 +1086,12 @@ execlist(Estate state, int dont_change_job, int exiting)
|
|||
donedebug = isset(ERREXIT) ? 2 : 1;
|
||||
opts[ERREXIT] = oerrexit_opt;
|
||||
} else
|
||||
donedebug = 0;
|
||||
donedebug = intrap ? 1 : 0;
|
||||
|
||||
if (ltype & Z_SIMPLE) {
|
||||
next = state->pc + WC_LIST_SKIP(code);
|
||||
execsimple(state);
|
||||
if (donedebug != 2)
|
||||
execsimple(state);
|
||||
state->pc = next;
|
||||
goto sublist_done;
|
||||
}
|
||||
|
|
|
@ -415,6 +415,20 @@
|
|||
>3 three
|
||||
>5 five
|
||||
|
||||
# Assignments are a special case, since they use a simpler
|
||||
# wordcode type, so we need to test skipping them separately.
|
||||
fn() {
|
||||
setopt localtraps localoptions debugbeforecmd
|
||||
trap '(( LINENO == 4 )) && setopt errexit' DEBUG
|
||||
x=three
|
||||
x=four
|
||||
print $LINENO $x
|
||||
[[ -o errexit ]] && print "Hey, ERREXIT is set!"
|
||||
}
|
||||
fn
|
||||
1:Skip assignment from DEBUG trap
|
||||
>5 three
|
||||
|
||||
%clean
|
||||
|
||||
rm -f TRAPEXIT
|
||||
|
|
Loading…
Reference in New Issue