From 17178db1a4d8700c9e10862d0dd496f92c53f1cd Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 9 Jul 2018 11:06:07 +0100 Subject: users/23531: Error exit/return fixes. Fix regression with trap on left hand side of pipe. Fix forced return from shell structure within nested function. Fix tests exiting too early. Add new test case. --- Test/C03traps.ztst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Test') diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst index f22962550..dce263f94 100644 --- a/Test/C03traps.ztst +++ b/Test/C03traps.ztst @@ -680,6 +680,22 @@ F:Must be tested with a top-level script rather than source or function >Better >In .zshenv + unsetopt errreturn + fn2() { + if true; then + false + fi + } + fn1() { + setopt localoptions errreturn + fn2 + print $? + } + fn1 + print fn1 done +0:ERR_RETURN caused by function returning false from within shell construct +>fn1 done + fn2() { if false; then print Bad @@ -741,6 +757,7 @@ F:Must be tested with a top-level script rather than source or function 0:ERR_EXIT not triggered by status 1 at end of { } >OK + unsetopt err_exit err_return (setopt err_exit for x in y; do false -- cgit 1.4.1