Phillip Susi wrote:
>>   trap "" 1 15
>>   if test -t 2>&1  ; then
>>       echo "Sending output to 'nohup.out'"
>>       exec nice -5 $* >>nohup.out 2>&1
>>   else
>>       exec nice -5 $* 2>&1
>>   fi
>>
>> All that nohup does is to ignore SIGHUP and SIGTERM and redirect the
>> output if it is not already redirected.  Before job control this was
>> all that was needed to avoid a controlling terminal disconnection from
>> killing the process.  Unfortunately with job control a little more is
>> needed.
> 
> Trapping the signals in the shell does not trap them in the exec'd child
> program, so I don't see how this would work.

Untrue, actually: _handling_ the signals would not handle them in the
exec'd child (for obvious reasons), but POSIX requires blocked signals
to remain blocked after an exec.

Try the following:

----
#!/bin/sh
trap "" TSTP
exec yes > /dev/null
----

and then try suspending the program with ^Z, with and without the "trap"
line commented out. :)

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/



_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to