zsh-workers
 help / color / mirror / code / Atom feed
* TRAPINT function set by parent shell causes subshell to misbehave
@ 2015-06-26 19:21 Patrick Palka
  2015-06-26 21:08 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2015-06-26 19:21 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-26 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 19:21 TRAPINT function set by parent shell causes subshell to misbehave Patrick Palka
2015-06-26 21:08 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).