BEGIN {
require './test.pl';
+ skip_all_if_miniperl();
+ skip_all_without_config(qw(d_fork));
}
use strict;
plan tests => 4;
SKIP: {
- skip 'Platform doesn\'t support SIGCHLD', 4 if is_miniperl() or not exists $SIG{CHLD};
+ skip 'Platform doesn\'t support SIGCHLD', 4 if not exists $SIG{CHLD};
require POSIX;
require Time::HiRes;
+ my @pids;
+ $SIG{CHLD} = sub {
+ while ((my $child = waitpid(-1, POSIX::WNOHANG())) > 0) {
+ note "Reaped: $child";
+ push @pids, $child;
+ }
+ };
my $pid = fork // die "Can't fork: $!";
unless ($pid) {
note("Child PID: $$");
test_system('without reaper');
- my @pids;
- $SIG{CHLD} = sub {
- while ((my $child = waitpid(-1, POSIX::WNOHANG())) > 0) {
- note "Reaped: $child";
- push @pids, $child;
- }
- };
-
test_system('with reaper');
note("Waiting briefly for SIGCHLD...");