[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] How to forbidden SIGINT be propagated from the parent sc
From: |
Peng Yu |
Subject: |
Re: [Help-bash] How to forbidden SIGINT be propagated from the parent script to the child script? |
Date: |
Fri, 29 May 2015 09:48:05 -0500 |
Is there a way to make any scripts (any their child scripts) called by
the main script not responsive to Ctrl-C?
On Fri, May 29, 2015 at 7:08 AM, Greg Wooledge <address@hidden> wrote:
> On Fri, May 29, 2015 at 12:23:24AM -0500, Peng Yu wrote:
>> The following shows that SIGINT is propagated to ./script.sh.
>
> Are you talking about keyboard-generated signals (Ctrl-C), or signals
> sent to a single process via the kill command?
>
> If you run a script from a terminal, in the foreground, and that script
> runs some other program synchronously (in the foreground), and you press
> Ctrl-C on your keyboard while focused on that terminal, the SIGINT will be
> sent to EVERY foreground process. This is not "propagation". It is not
> one process receiving the signal and passing it along to its children.
> Processes do not do that. If you wanted that, you would have to code
> it yourself.
>
> Keyboard-generated signals are sent by the terminal driver to every
> foreground process at once.
--
Regards,
Peng