diff options
author | Peter Stephenson <p.stephenson@samsung.com> | 2023-07-20 10:46:14 +0100 |
---|---|---|
committer | Peter Stephenson <p.stephenson@samsung.com> | 2023-07-20 10:46:14 +0100 |
commit | 03695f4b5819d5f20ad0ad241d9255ba8cbd8e91 (patch) | |
tree | 71bd1766cc08c1cec0ab1333440e308d0225d7fe /Src | |
parent | 5ec4695033b9a3a57492b60439d9e3a922d9bcd1 (diff) | |
download | zsh-03695f4b5819d5f20ad0ad241d9255ba8cbd8e91.tar.gz zsh-03695f4b5819d5f20ad0ad241d9255ba8cbd8e91.tar.xz zsh-03695f4b5819d5f20ad0ad241d9255ba8cbd8e91.zip |
51977: PIPEFAIL interaction with ERREXIT / ERRRETURN
Ensure the list-level error handling code is executed if we detect pipe failure for a foreground job. Add tests.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/jobs.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Src/jobs.c b/Src/jobs.c index dd7bba405..a3b9f667a 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -427,11 +427,17 @@ storepipestats(Job jn, int inforeground, int fixlastval) } if (fixlastval) { - if (jn->stat & STAT_CURSH) { - if (!lastval && isset(PIPEFAIL)) - lastval = pipefail; - } else if (isset(PIPEFAIL)) - lastval = pipefail; + if (jn->stat & STAT_CURSH) { + if (!lastval && isset(PIPEFAIL)) { + if (inforeground) + this_noerrexit = 0; + lastval = pipefail; + } + } else if (isset(PIPEFAIL)) { + if (inforeground) + this_noerrexit = 0; + lastval = pipefail; + } } } |