Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
TRAPINT function set by parent shell causes subshell to misbehave
- X-seq: zsh-workers 35618
- From: Patrick Palka <patrick@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: TRAPINT function set by parent shell causes subshell to misbehave
- Date: Fri, 26 Jun 2015 15:21:40 -0400
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hi,
Consider the following testcase:
$ (echo | less)
$ TRAPINT() { }
$ (echo | less)
$ (TRAPINT() { }; echo | less)
During the first execution of (echo | less) -- when a TRAPINT function
is not yet defined -- notice how sending ^C does not kill the 'less'
process or the subshell.
During the second execution of (echo | less) -- after a TRAPINT
function has been defined -- now sending ^C _does_ kill the subshell
(and the 'less' process along with it)
During the third execution of (echo | less) -- after a TRAPINT
function has been defined in the parent shell and redefined in the
subshell -- sending ^C no longer kills the subshell.
So when a TRAPINT function is defined in the parent shell and not
redefined in the subshell, then the subshell decides to exit when
SIGINT is sent to it -- at least when the 'less' command is run. When
(echo | less) is replaced with e.g. (nano) then ^C does not kill the
subshell. Nonetheless I would expect that the 2nd execution always
behaves like the 1st and 3rd executions.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author