diff options
author | Peter Stephenson <pws@zsh.org> | 2016-10-05 13:52:31 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-10-05 13:52:31 +0100 |
commit | 0854ee56bc559d7fd614eb7d59b61da84a9ce51f (patch) | |
tree | 08c823e058470f679054797bde81e8e73ce80b1d /Src | |
parent | d033f03688f3c8a307c656ffe465340a24053122 (diff) | |
download | zsh-0854ee56bc559d7fd614eb7d59b61da84a9ce51f.tar.gz zsh-0854ee56bc559d7fd614eb7d59b61da84a9ce51f.tar.xz zsh-0854ee56bc559d7fd614eb7d59b61da84a9ce51f.zip |
39568: "! <complex-command>" suppresses ERR_EXIT
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c index f248ca288..741c80e30 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1317,8 +1317,13 @@ execlist(Estate state, int dont_change_job, int exiting) next = state->pc + WC_SUBLIST_SKIP(code); if (!oldnoerrexit) noerrexit = !isend; - if ((WC_SUBLIST_FLAGS(code) & WC_SUBLIST_NOT) && isend) - this_noerrexit = 1; + if (WC_SUBLIST_FLAGS(code) & WC_SUBLIST_NOT) { + /* suppress errexit for "! this_command" */ + if (isend) + this_noerrexit = 1; + /* suppress errexit for ! <list-of-shell-commands> */ + noerrexit = 1; + } switch (WC_SUBLIST_TYPE(code)) { case WC_SUBLIST_END: /* End of sublist; just execute, ignoring status. */ |