summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/exec.c1
-rw-r--r--Test/C03traps.ztst17
3 files changed, 21 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c0afd0773..b912821e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2016-12-05 Peter Stephenson <p.stephenson@samsung.com>
+ * 40097: Src/exec.c, Test/C03traps.ztst: Don't trigger ERR_EXIT
+ or ERR_RETURN on non-zero status after current shell group, either.
+
* 40096: Src/exec.c, Src/loop.c, Src/zsh.h, Test/C03traps.ztst:
Don't trigger ERR_EXIT or ERR_RETURN on non-zero status after
shell construct.
diff --git a/Src/exec.c b/Src/exec.c
index 6e197ddf2..a439aec7f 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -429,6 +429,7 @@ execcursh(Estate state, int do_exec)
cmdpop();
state->pc = end;
+ this_noerrexit = 1;
return lastval;
}
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index e94fb6f85..dc386a44e 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -664,6 +664,15 @@ F:Must be tested with a top-level script rather than source or function
>OK
(setopt err_exit
+ {
+ false && true
+ }
+ print OK
+ )
+0:ERR_EXIT not triggered by status 1 at end of { }
+>OK
+
+ (setopt err_exit
for x in y; do
false
done
@@ -696,6 +705,14 @@ F:Must be tested with a top-level script rather than source or function
)
1:ERR_EXIT triggered by status 1 within if
+ (setopt err_exit
+ {
+ false
+ }
+ print OK
+ )
+1:ERR_EXIT triggered by status 1 within { }
+
if zmodload zsh/system 2>/dev/null; then
(
trap 'echo TERM; exit 2' TERM