- my $fpid = fork;
- if ($fpid == 0) {
- open STDOUT, '>>', "$tmpdir/1" or die "redirect failed: $!";
- open STDERR, '>>', "$tmpdir/2" or die "redirect failed: $!";
- exec $httpd, '-l', $unix, '-W0', $psgi;
- die "FAIL: $!\n";
- }
- is($fpid, waitpid($fpid, 0), 'second httpd exits');
- isnt($?, 0, 'httpd failed with failure to bind');
+ my %err = ( 'linux' => EADDRINUSE );
+ open my $out, '>>', "$tmpdir/1" or die "redirect failed: $!";
+ open my $err, '>>', "$tmpdir/2" or die "redirect failed: $!";
+ my $cmd = ['-httpd', '-l', $unix, '-W0', $psgi];
+ my $ftd = start_script($cmd, undef, { 1 => $out, 2 => $err });
+ $ftd->join;
+ isnt($?, 0, 'httpd failure set $?');
+ SKIP: {
+ my $ec = $err{$^O} or
+ skip("not sure if $^O fails with EADDRINUSE", 1);
+ is($? >> 8, $ec, 'httpd failed with EADDRINUSE');
+ };