Handling and propagating signals

David Cantrell david at cantrell.org.uk
Thu Feb 1 16:40:54 GMT 2007

Someone just reported what I'm inclined to treat as a bug in rsnapshot.
Boiled down to a minimal example, it's this:

perl -e '$SIG{TERM} = sub { exit() }; system("sleep 60")'

Now send that process a SIGTERM.  The perl process promptly exits.  The
command I ran using system(), however, does not.  I want my signal
handler to propagate the signal to children as well.

Because the signal is received while perl is waiting for system() to
return, I can't see any way in which I can possibly know the child's
PID without having to grovel through the process table.

David Cantrell | Cake Smuggler Extraordinaire

"The whole aim of practical politics is to keep the populace alarmed
 (and hence clamorous to be led to safety) by menacing it with an
 endless series of hobgoblins, all of them imaginary"  -- H. L. Mencken

More information about the london.pm mailing list