Skip to content

Commit d40d1ea

Browse files
tonycozmauke
authored andcommitted
closepid.t: pclose tests that fail on Win32
This includes an old test I wrote for pclose blocking on non-Win32 (which up until this fix used distinct pclose code from Win32) and test code for Perl#4106, which is the main issue being fixed by this patch series.
1 parent 90027ee commit d40d1ea

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

t/io/closepid.t

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ BEGIN {
66
set_up_inc('../lib');
77
}
88

9-
plan tests => 3;
10-
watchdog(10, $^O eq 'MSWin32' ? "alarm" : '');
11-
129
use Config;
1310
$| = 1;
1411
$SIG{PIPE} = 'IGNORE';
@@ -21,10 +18,28 @@ my $perl = which_perl();
2118
my $killsig = 'HUP';
2219
$killsig = 1 unless $Config{sig_name} =~ /\bHUP\b/;
2320

21+
{
22+
local $::TODO = $^O eq "MSWin32" ? "not fixed yet #4106" : undef;
23+
# github #4106
24+
open my $saveout, ">&", \*STDOUT or die;
25+
my $start = time();
26+
open STDOUT, "|-", $perl, "-e", "sleep 2"
27+
or die;
28+
print STDOUT "Hi\n" for 1..2;
29+
my $close_ok = close STDOUT;
30+
open STDOUT, ">&", $saveout;
31+
ok($close_ok, "close pipe to child success");
32+
cmp_ok(time(), '>', $start, "close waited at least a bit");
33+
}
34+
35+
watchdog(10, $^O eq 'MSWin32' ? "alarm" : '');
36+
2437
SKIP:
2538
{
2639
skip("Not relevant to $^O", 3)
27-
if $^O eq "MSWin32" || $^O eq "VMS";
40+
if $^O eq "VMS";
41+
skip "Waits for any child on Windows", 3
42+
if $^O eq "MSWin32";
2843
skip("only matters for waitpid or wait4", 3)
2944
unless $Config{d_waitpid} || $Config{d_wait4};
3045
# [perl #119893]
@@ -42,3 +57,5 @@ SKIP:
4257
kill $killsig, $pid;
4358
open STDIN, "<&", $savein;
4459
}
60+
61+
done_testing();

0 commit comments

Comments
 (0)