Subject: | forkm.t problem with perl 5.8 |
I've had some problems with forkm.t under perl 5.8.3 on RH9 and Solaris 8. The tests themselves work, but all of the children spawned by forkm.t don't get reaped, and eventually it times out. Using the 'better' signal handler from the perlipc man page fixes the problem.
--- ./t/forkm.t.prepatch 2001-04-08 09:50:15.000000000 -0500
+++ ./t/forkm.t 2004-04-28 17:11:37.000000000 -0500
@@ -8,6 +8,7 @@
use Net::Daemon::Test ();
use Fcntl ();
use Config ();
+use POSIX ":sys_wait_h";
my $ok;
eval {
@@ -102,10 +103,12 @@
my %childs;
sub CatchChild {
- my $pid = wait;
- if (exists $childs{$pid}) {
- delete $childs{$pid};
- ShowResults() if (keys(%childs) == 0);
+ my $pid;
+ while (($pid = waitpid(-1,WNOHANG)) > 0) {
+ if (exists $childs{$pid}) {
+ delete $childs{$pid};
+ ShowResults() if (keys(%childs) == 0);
+ }
}
$SIG{'CHLD'} = \&CatchChild;
}