in reply to How to optionally kill a child, and capture status if not killed.
I would get rid of the SIGCHLD handler, and structure your code to look something like this:
my $script_pid = fork(); ...launch script process... my $abort_pid = fork(); ...launch abort button process.., my $pid = wait; # see who finishes first my $st = $?; # save status if ($pid == $script_pid) { # script finished kill 9, $abort_pid; } else { # assume $pid == $abort_pid, or check it # abort button finished kill 9, $script_pid; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to optionally kill a child, and capture status if not killed.
by joelr (Novice) on Apr 25, 2008 at 21:49 UTC |