bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ctrl-c does not send INT to all processes under foreground job


From: Stephane Chazelas
Subject: Re: ctrl-c does not send INT to all processes under foreground job
Date: Wed, 19 Mar 2014 23:09:45 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2014-03-19 09:51:06 -0400, Chet Ramey:
[...]
> This is another instance of the question "what does bash do with a SIGINT
> it receives while waiting for a foreground process?"  The answer is that it
> allows the child to decide what to do and responds accordingly: if the
> child exits due to being killed by the SIGINT, bash acts as if it received
> the SIGINT; if the child decides to trap it, do something else and not
> resend the SIGINT to itself, bash will effectively discard it.  In any
> case, bash doesn't do anything until the child exits.
> 
> There is a fairly long explanation of the issue at
> http://www.cons.org/cracauer/sigint.html.
[...]

But that's about the

bash -c 'sh -c "trap : INT; sleep 10"; echo seen; sleep 10'

where bash and AT&T ksh (contrary to all other shells I tried)
let you see "seen" above if you press Ctrl-C during the first
sleep.

But in the OP's case, we've got a "trap" in the outer shell.

bash -c 'trap "echo ouch" INT;
  sh -c "trap : INT; sleep 10"; echo seen; sleep 10'

Where you see "ouch" and "seen" in all shells (regardless of
whether the inner sh traps the SIGINT or not). So it looks like
a different issue.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]