diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-08-24 19:46:20 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2017-08-24 19:46:20 +0100 |
commit | 97d4bdbc7e86e6e8da0d4a059b118ffab289d3a9 (patch) | |
tree | 4b00406423534eb1b472ca29401e1683c73d9178 /Src/loop.c | |
parent | d6aa94997750a63712c8928b243b7c61fa73878b (diff) | |
download | zsh-97d4bdbc7e86e6e8da0d4a059b118ffab289d3a9.tar.gz zsh-97d4bdbc7e86e6e8da0d4a059b118ffab289d3a9.tar.xz zsh-97d4bdbc7e86e6e8da0d4a059b118ffab289d3a9.zip |
41590 modified as 41595: make ERR_RETURN more logical.
It now operates separately at each function depth. To keep ERR_EXIT global, make the noerrexit variable usd bit flags. Extend tests.
Diffstat (limited to 'Src/loop.c')
-rw-r--r-- | Src/loop.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/loop.c b/Src/loop.c index f7eae307b..4859c976b 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -542,7 +542,7 @@ execif(Estate state, int do_exec) end = state->pc + WC_IF_SKIP(code); if (!noerrexit) - noerrexit = 1; + noerrexit = NOERREXIT_EXIT | NOERREXIT_RETURN; while (state->pc < end) { code = *state->pc++; if (wc_code(code) != WC_IF || @@ -567,7 +567,12 @@ execif(Estate state, int do_exec) if (run) { /* we need to ignore lastval until we reach execcmd() */ - noerrexit = olderrexit ? olderrexit : lastval ? 2 : 0; + if (olderrexit) + noerrexit = olderrexit; + else if (lastval) + noerrexit = NOERREXIT_EXIT | NOERREXIT_RETURN | NOERREXIT_UNTIL_EXEC; + else + noerrexit = 0; cmdpush(run == 2 ? CS_ELSE : (s ? CS_ELIFTHEN : CS_IFTHEN)); execlist(state, 1, do_exec); cmdpop(); |