[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Process group of foreground processes in monitor mode
From: |
Chet Ramey |
Subject: |
Re: Process group of foreground processes in monitor mode |
Date: |
Fri, 15 Apr 2011 09:31:00 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
On 4/14/11 11:41 AM, Paolo Herms wrote:
> Bash Version: 4.2
> Patch Level: 8
> Release Status: release
>
> Description:
> In a bash script I have to switch on job control using set -m, as it seems to
> be the only way to trap a SIGCHLD as soon as a background process terminates.
> The documentation says that 'Background processes run in a separate process
> group [...]' and this is good. Now it looks like switching on this monitor
> mode leads also foreground processes to run in a seperate process group. This
> is a bug, because specification suggests the contrary, and a problem, because
> the foreground process should receive signals sent to the script's process
> group.
Sorry the documentation is unclear. All jobs run in separate process
groups when job control/monitor mode is enabled. Background processes
get a line describing their exit status when they complete. The section
on job control explains this in somewhat more detail.
When job control is enabled, foreground jobs should not receive signals
sent to the shell's process group. That is one of the reasons to enable
job control.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/