mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
39901: No EXIT trap on LHS of pipeline.
There is a special case if the LHS is a shell construct. Add unit tests for both cases.
This commit is contained in:
parent
370b278565
commit
5f1700755f
3 changed files with 26 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2016-11-10 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 39901: Src/exec.c, Test/C03traps.ztst: Exiting the left hand
|
||||
side of a pipeline shouldn't trigger EXIT trap.
|
||||
|
||||
2016-11-09 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 39890: Completion/Debian/Command/_git-buildpackage,
|
||||
|
|
|
@ -1888,6 +1888,10 @@ execpline2(Estate state, wordcode pcode,
|
|||
entersubsh(((how & Z_ASYNC) ? ESUB_ASYNC : 0)
|
||||
| ESUB_PGRP | ESUB_KEEPTRAP);
|
||||
close(synch[1]);
|
||||
if (sigtrapped[SIGEXIT])
|
||||
{
|
||||
unsettrap(SIGEXIT);
|
||||
}
|
||||
execcmd_exec(state, &eparams, input, pipes[1], how, 1);
|
||||
_exit(lastval);
|
||||
}
|
||||
|
|
|
@ -641,6 +641,23 @@ F:Must be tested with a top-level script rather than source or function
|
|||
>TERM
|
||||
>EXIT
|
||||
|
||||
# Should not get "hello" in the single quotes.
|
||||
(
|
||||
trap "echo hello" EXIT;
|
||||
{ :; } | { read line; print "'$line'"; }
|
||||
)
|
||||
0:EXIT trap not called in LHS of pipeline: Shell construct on LHS
|
||||
>''
|
||||
>hello
|
||||
|
||||
(
|
||||
trap "echo hello" EXIT;
|
||||
cat </dev/null | { read line; print "'$line'"; }
|
||||
)
|
||||
0:EXIT trap not called in LHS of pipeline: External command on LHS
|
||||
>''
|
||||
>hello
|
||||
|
||||
%clean
|
||||
|
||||
rm -f TRAPEXIT
|
||||
|
|
Loading…
Reference in a new issue