1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

Additional case for ERR_RETURN and ERR_EXIT.

Don't trigger just because status is non-zero at end of
current shell group.
This commit is contained in:
Peter Stephenson 2016-12-05 12:29:23 +00:00
parent c03228f9ed
commit 0e4aa6f2f6
3 changed files with 21 additions and 0 deletions

@ -1,5 +1,8 @@
2016-12-05 Peter Stephenson <p.stephenson@samsung.com>
* 40097: Src/exec.c, Test/C03traps.ztst: Don't trigger ERR_EXIT
or ERR_RETURN on non-zero status after current shell group, either.
* 40096: Src/exec.c, Src/loop.c, Src/zsh.h, Test/C03traps.ztst:
Don't trigger ERR_EXIT or ERR_RETURN on non-zero status after
shell construct.

@ -429,6 +429,7 @@ execcursh(Estate state, int do_exec)
cmdpop();
state->pc = end;
this_noerrexit = 1;
return lastval;
}

@ -661,6 +661,15 @@ F:Must be tested with a top-level script rather than source or function
print OK
)
0:ERR_EXIT not triggered by status 1 at end of if
>OK
(setopt err_exit
{
false && true
}
print OK
)
0:ERR_EXIT not triggered by status 1 at end of { }
>OK
(setopt err_exit
@ -696,6 +705,14 @@ F:Must be tested with a top-level script rather than source or function
)
1:ERR_EXIT triggered by status 1 within if
(setopt err_exit
{
false
}
print OK
)
1:ERR_EXIT triggered by status 1 within { }
if zmodload zsh/system 2>/dev/null; then
(
trap 'echo TERM; exit 2' TERM