bug-bash
[Top][All Lists]
Advanced

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

Re: Background processes receive SIGINT even though they shouldn't


From: Chet Ramey
Subject: Re: Background processes receive SIGINT even though they shouldn't
Date: Thu, 12 Jan 2006 08:36:30 -0500
User-agent: Thunderbird 1.5 (Macintosh/20051201)

Ingemar Nilsson wrote:

> Machine Type: i386-redhat-linux-gnu
> 
> Bash Version: 3.0
> Patch Level: 16
> Release Status: release
> 
> Description:
>         In some cases, background processes receive SIGINT from the
>         terminal where it was started even though the manual states
>         that such processes are immune to keyboard-generated signals.
>         This is best explained by trying out the example below.
> 
>         There is a reason for the seemingly complex sleep arrangement
>         in test2. This is really a condensed version of a much larger
>         script, but it still demonstrates the problem well.

I think you're slightly misunderstanding how job control and process
groups interact.

When you run test1 from an interactive shell with job control enabled,
it is placed into a separate process group.  The terminal's foreground
process group is set to test1's process group, which means that group
receives keyboard-generated signals like SIGINT.

The shell started to run test1 is not interactive, so job control is
disabled.  This means that all processes started by test1 and its
descendants are placed into the same process group.  Since this is
the terminal's foreground process group, these processes receive the
SIGINT.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live Strong.
Chet Ramey, ITS, CWRU    chet@case.edu    http://tiswww.tis.case.edu/~chet/




reply via email to

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