1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-13 11:06:17 +02:00

50068: 'exit' in trap causes calling function to return

This commit is contained in:
Bart Schaefer 2022-04-14 16:31:50 -07:00
parent 0ad3b11a13
commit d24d7242fe
3 changed files with 3 additions and 4 deletions

View File

@ -30,9 +30,6 @@ skipped when STTY=... is set for that command
------------------------------------------------------------------------
42609: :|: =(hang)
------------------------------------------------------------------------
44007 - Martijn - exit in trap executes rest of function
See test case in Test/C03traps.ztst.
------------------------------------------------------------------------
44133 debian #924736 (partial patch in 44134) three setopts following ` #`
------------------------------------------------------------------------
44850 terminal issues with continuation markers

View File

@ -5720,6 +5720,8 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
* a bad job.
*/
if (stopmsg || (zexit(0, ZEXIT_DEFERRED), !stopmsg)) {
if (trap_state)
trap_state = TRAP_STATE_FORCE_RETURN;
retflag = 1;
breaks = loops;
exit_pending = 1;

View File

@ -901,7 +901,7 @@ F:Must be tested with a top-level script rather than source or function
fn trap1 trap2
echo out2
'
-f:(workers/44007) function execution continues after 'exit' in trap
-:(workers/44007) function execution continues after 'exit' in trap
>out1
>fn1
>trap1