The child isn't hanging around much. I wouldn't be surprised if you never got the "Outta here" message.use strict; my $pid = fork(); if ($pid) { print "I am parent $$\n"; kill INT => $pid; print "I am parent $$\n"; } elsif (defined($pid)) { print "I am child $$\n"; local $SIG{INT} = sub { die "\nOutta here!\n" }; print "I am child $$\n"; exit 1; } else { print "child was not created\n"; }
You'll want the child to block. Add sleep 30 or something, after setting up the $SIG{INT}.
-- Randal L. Schwartz, Perl hacker
In reply to •Re: Catching signals
by merlyn
in thread Catching signals
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |