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 /Test | |
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 'Test')
-rw-r--r-- | Test/E01options.ztst | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Test/E01options.ztst b/Test/E01options.ztst index 533e08773..83f0371a1 100644 --- a/Test/E01options.ztst +++ b/Test/E01options.ztst @@ -1379,6 +1379,64 @@ F:Regression test for workers/41811 >1 >2 + pipefailfn1() { + emulate -L zsh + setopt errreturn pipefail + false | { true; } + print "Shouldn't get here, status $?" + } + pipefailfn1 +1:PIPE_FAIL causes ERR_RETURN with complex end of pipeline: braces + + pipefailfn2() { + emulate -L zsh + setopt errreturn pipefail + false | if true; then true; fi + print "Shouldn't get here, status $?" + } + pipefailfn2 || print Function failed, as expected +0:PIPE_FAIL causes ERR_RETURN with complex end of pipeline: if +>Function failed, as expected + + pipefailfn3() { + emulate -L zsh + setopt errreturn pipefail + false | while true; do break; done + print "Shouldn't get here, status $?" + } + pipefailfn3 || print Function failed, as expected +0:PIPE_FAIL causes ERR_RETURN with complex end of pipeline: while +>Function failed, as expected + + pipefailfn4() { + emulate -L zsh + setopt errreturn pipefail + false | true + print "Shouldn't get here, status $?" + } + pipefailfn4 +1:PIPE_FAIL causes ERR_RETURN in simple case + + pipefailfn5() { + emulate -L zsh + setopt errreturn pipefail + false | { true | true; } + print "Shouldn't get here, status $?" + } + pipefailfn5 || print Function failed as expected +0:PIPE_FAIL causes ERR_RETURN with nested successful pipe +>Function failed as expected + + pipefailfn6() { + emulate -L zsh + setopt errreturn pipefail + false | { false | true; } + print "Shouldn't get here, status $?" + } + pipefailfn6 || print Function failed as expected +0:PIPE_FAIL causes ERR_RETURN with nested failed pipe +>Function failed as expected + for (( i = 0; i < 10; i++ )); do () { print $i |