jpfarmer has asked for the wisdom of the Perl Monks concerning the following question:
Greetings fellow monks!
I have an application that forks off a continually-running child process. In the course of the child's life, it frequently shells out to run different applications. As a result, it will sometimes disregard signals (INT and HUP) if the signal is sent while the child is in one of these processes.
Is there a way to correct this behavior? I would like it to wait for the forked application to complete then perform whatever the signal requires. Can I only do this by forking another child process to execute the system command?
Here is how I'm handling the interrupt now:
$SIG{'INT'} = 'stop_child'; sub stop_child{ print "Recieved stop signal.\n"; exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Ensuring signal receipt under Linux
by chrism01 (Friar) on Jan 24, 2006 at 23:09 UTC |