in reply to Re: Forking Issue
in thread Forking Issue
This example will not catch errors with fork. You first need to test if the returned $pid is defined or not:
unless(defined(my $pid = fork)) { die "Could not fork: $!"; #fork failed } elsif($pid) { sleep 1; #parent kill 9, $pid; wait; } else { print "Yay!\n" while 1; #child }
|
|---|