summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2016-12-05 13:49:45 +0000
committerPeter Stephenson <pws@zsh.org>2016-12-05 13:49:45 +0000
commit9649ef588882419046f66a7a7db18f3cff8106f9 (patch)
treeafa49b631b98bb41ee3d51fbe69f776f81302155
parent0e4aa6f2f64fb276537adecfe755a752a3fcccb1 (diff)
downloadzsh-9649ef588882419046f66a7a7db18f3cff8106f9.tar.gz
zsh-9649ef588882419046f66a7a7db18f3cff8106f9.zip
40100: ERR_EXIT and ERR_RETURN test for anonymous functions.
Should trigger on non-zero status at end of function even if behaviour is suppressed by code inside the function at the point the status is set.
-rw-r--r--ChangeLog4
-rw-r--r--Test/C03traps.ztst11
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b912821e2..3e06cfa83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2016-12-05 Peter Stephenson <p.stephenson@samsung.com>
+ * 40100: Test/C03traps.ztst: Check ERR_EXIT and ERR_RETURN on
+ anonymous functions: should exit on function return even if
+ suppressed internally.
+
* 40097: Src/exec.c, Test/C03traps.ztst: Don't trigger ERR_EXIT
or ERR_RETURN on non-zero status after current shell group, either.
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index dc386a44e..7bc0b486d 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -713,6 +713,17 @@ F:Must be tested with a top-level script rather than source or function
)
1:ERR_EXIT triggered by status 1 within { }
+ (setopt err_exit
+ () {
+ false && true
+ print Still functioning
+ false && true
+ }
+ print OK
+ )
+1:ERR_EXIT triggered by status 1 at end of anon func
+>Still functioning
+
if zmodload zsh/system 2>/dev/null; then
(
trap 'echo TERM; exit 2' TERM