From 8f5fe841a63fecdab4416578653549689f2c592f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 17 Apr 2023 09:30:34 +0100 Subject: 51652: fix running of TRAPEXIT explicitly. This is a special case where TRAPEXIT is unset within a TRAPEXIT as it should never run in a nested context, so just save the function structure temporarily on the heap. --- Test/C03traps.ztst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Test') diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst index e0b6afb5f..de57765a0 100644 --- a/Test/C03traps.ztst +++ b/Test/C03traps.ztst @@ -1083,6 +1083,17 @@ F:Must be tested with a top-level script rather than source or function >trap1 # As of 5.7.1-test-2, the output was "out1 fn1 trap1 fn2" (on separate lines). + TRAPEXIT() { echo This is TRAPEXIT; } + TRAPEXIT + TRAPEXIT + TRAPEXIT +0:No memory problems with explicit call to TRAPEXIT. +>This is TRAPEXIT +>This is TRAPEXIT +>This is TRAPEXIT +>This is TRAPEXIT +# Three explicit calls, one implicit call at function exit. + %clean rm -f TRAPEXIT -- cgit 1.4.1