in reply to Catching signals
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: •Re: Catching signals
by Anonymous Monk on Sep 04, 2002 at 18:13 UTC | |
by merlyn (Sage) on Sep 04, 2002 at 18:26 UTC | |
by gri6507 (Deacon) on Sep 04, 2002 at 18:41 UTC | |
by gri6507 (Deacon) on Sep 05, 2002 at 20:50 UTC |