diff options
author | Philippe Altherr <philippe.altherr@gmail.com> | 2022-12-03 20:35:58 -0800 |
---|---|---|
committer | Bart Schaefer <schaefer@zsh.org> | 2022-12-03 20:35:58 -0800 |
commit | fda6fd9513ffdbd75c490e8e55ce33f370a9bd17 (patch) | |
tree | 49ee5e9338dd9128f36e4736be41984eb7f628f7 | |
parent | 23dc19f005b6a9ac0740b46155f14dbcfa697421 (diff) | |
download | zsh-fda6fd9513ffdbd75c490e8e55ce33f370a9bd17.tar.gz zsh-fda6fd9513ffdbd75c490e8e55ce33f370a9bd17.zip |
51001: fix for ERR_EXIT with "always" blocks; update tests
-rw-r--r-- | Src/loop.c | 1 | ||||
-rw-r--r-- | Test/C03traps.ztst | 36 |
2 files changed, 30 insertions, 7 deletions
diff --git a/Src/loop.c b/Src/loop.c index db5b3e097..7c3e04b8a 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -793,6 +793,7 @@ exectry(Estate state, int do_exec) cmdpop(); popheap(); state->pc = end; + this_noerrexit = 1; return endval; } diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst index a7a040d70..4719dfd57 100644 --- a/Test/C03traps.ztst +++ b/Test/C03traps.ztst @@ -721,22 +721,19 @@ F:Must be tested with a top-level script rather than source or function >Good (setopt err_exit - for x in y; do - false && true - done + false && true print OK ) -0:ERR_EXIT not triggered by status 1 at end of for +0:ERR_EXIT not triggered by "false && true" >OK (setopt err_exit - integer x=0 - while (( ! x++ )); do + for x in y; do false && true done print OK ) -0:ERR_EXIT not triggered by status 1 at end of while +0:ERR_EXIT not triggered by status 1 at end of for >OK (setopt err_exit @@ -758,6 +755,31 @@ F:Must be tested with a top-level script rather than source or function >OK (setopt err_exit + loop=true + while print COND; $loop; do + loop=false + false && true + done + print OK + ) +0:ERR_EXIT not triggered by status 1 at end of while +>COND +>COND +>OK + + (setopt err_exit + { + false && true + } always { + print ALWAYS + } + print OK + ) +0:ERR_EXIT not triggered by status 1 at end of always +>ALWAYS +>OK + + (setopt err_exit { false && true } |