1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-02 20:00:57 +02:00

25643: keep DEBUG and ZERR traps in subshells

This commit is contained in:
Peter Stephenson 2008-09-11 14:47:18 +00:00
parent 8bb15c1392
commit fb67cd46ea
3 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2008-09-11 Peter Stephenson <pws@csr.com>
* 25643: Doc/Zsh/builtins.yo, Src/exec.c: keep DEBUG and ZERR
traps in subshells.
* 25641: add option (NO_)MULTI_FUNC_DEF to turn off "foo1
foo2...()" function definitions.

View file

@ -1330,7 +1330,9 @@ If var(sig) is tt(0) or tt(EXIT)
and the tt(trap) statement is not executed inside the body of a function,
then the command var(arg) is executed when the shell terminates.
tt(ZERR), tt(DEBUG), and tt(EXIT) traps are not executed inside other traps.
tt(ZERR), tt(DEBUG), and tt(EXIT) traps are not executed inside other
traps. tt(ZERR) and tt(DEBUG) traps are kept within subshells, while
other traps are reset.
Note that traps defined with the tt(trap) builtin are slightly different
from those defined as `tt(TRAP)var(NAL) () { ... }', as the latter have

View file

@ -869,7 +869,8 @@ entersubsh(int flags)
if (!(flags & ESUB_KEEPTRAP))
for (sig = 0; sig < VSIGCOUNT; sig++)
if (!(sigtrapped[sig] & ZSIG_FUNC))
if (!(sigtrapped[sig] & ZSIG_FUNC) &&
sig != SIGDEBUG && sig != SIGZERR)
unsettrap(sig);
monitor = isset(MONITOR);
if (flags & ESUB_NOMONITOR)