Handling and propagating signals

bah@longitude.com bah at longitude.com
Thu Feb 1 18:17:12 GMT 2007

Two thoughts.  First, what happens if you resend the signal to -$$ in the
signal handler?  Ought this not propagate the signal to all processes in
your process group?  Second thought, if that doesn't work for your target
platforms, why not use open "|-" and exec instead of system; that way you
will get the pid.


> 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