[Top][All Lists]

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

Re: bug in force_interactive handling

From: Chet Ramey
Subject: Re: bug in force_interactive handling
Date: Mon, 02 Jan 2012 13:53:42 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 1/2/12 1:38 PM, Stas Sergeev wrote:
> 02.01.2012 22:27, Chet Ramey wrote:
>>> In this case it would be nice for bash to have
>>> a signal that will move the background process
>>> to the foreground.
>> But there is already a command to do that: fg.
> Sorry, mistyped, I meant the other way around: move
> the foreground process to the background, then finish
> the script, leaving the process alive.

The SIGSTOP/SIGCONT works to put the process into the background: the
jobs pgrp is not the same as the terminal's pgrp.  If you don't want
the shell to terminate the job at exit because it's stopped, use
`disown' after the job stops to have the shell forget it while you
continue it from another process.

> Will your suggestion about the trap handler work
> also for ^Z+bg rather than just fg?

It should.

I know that `cat' was just an example, but you have to make sure the
job you want to stop/continue is not attempting to read from the terminal.
If it is, the kernel will SIGTSTP it every time.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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