From d7110d8f01cae8c8d51c7abd0255f533cd8b8623 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Thu, 27 Apr 2017 18:56:18 +0100
Subject: 41012: Fix premature exit from nested function in EXIT trap.
Also add check so we don't delay an exit if we were already in
an EXIT trap for the main shell, as we should in that case leave
immediately.
---
Test/C03traps.ztst | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
(limited to 'Test')
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 7bc0b486d..759401225 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -756,6 +756,27 @@ F:Must be tested with a top-level script rather than source or function
>''
>hello
+ $ZTST_testdir/../Src/zsh -f =(<<<"
+ trap handler EXIT
+ handler() {
+ echoa
+ echo b
+ }
+ echoa() {
+ echo a
+ }
+ exit0() {
+ exit
+ }
+ main() {
+ exit0
+ }
+ main
+ ")
+0:No early exit from nested function in EXIT trap.
+>a
+>b
+
%clean
rm -f TRAPEXIT
--
cgit 1.4.1