summaryrefslogtreecommitdiff
path: root/t/io/pipe.t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-05-15 22:21:41 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-05-15 22:21:41 +0000
commit1d3434b8c1ecb43ba830424cfca969ab84444ed7 (patch)
treef1b72339d10b3ba328781e90cf5ea9cfa0830cf0 /t/io/pipe.t
parent067391eacdcfc760b09b573f48f90fa54dd5e5b4 (diff)
downloadperl-1d3434b8c1ecb43ba830424cfca969ab84444ed7.tar.gz
[win32] merge changes#982,984 from maintbranch
p4raw-link: @984 on //depot/maint-5.004/perl: aaffd3c27a04135bbc287616252cc5830b7c5543 p4raw-link: @982 on //depot/maint-5.004/perl: c5ed518aab0e5c6006080a87273e79a1b8e0d48b p4raw-id: //depot/win32/perl@997
Diffstat (limited to 't/io/pipe.t')
-rwxr-xr-xt/io/pipe.t26
1 files changed, 24 insertions, 2 deletions
diff --git a/t/io/pipe.t b/t/io/pipe.t
index 0387e556ca..4a7cb7a423 100755
--- a/t/io/pipe.t
+++ b/t/io/pipe.t
@@ -13,7 +13,7 @@ BEGIN {
}
$| = 1;
-print "1..10\n";
+print "1..12\n";
open(PIPE, "|-") || (exec 'tr', 'YX', 'ko');
print PIPE "Xk 1\n";
@@ -25,6 +25,7 @@ if (open(PIPE, "-|")) {
s/^not //;
print;
}
+ close PIPE; # avoid zombies which disrupt test 12
}
else {
print STDOUT "not ok 3\n";
@@ -40,6 +41,7 @@ if ($pid = fork) {
y/A-Z/a-z/;
print;
}
+ close READER; # avoid zombies which disrupt test 12
}
else {
die "Couldn't fork" unless defined $pid;
@@ -66,11 +68,13 @@ sleep 1;
print "ok 8\n";
# VMS doesn't like spawning subprocesses that are still connected to
-# STDOUT. Someone should modify tests #9 and #10 to work with VMS.
+# STDOUT. Someone should modify tests #9 to #12 to work with VMS.
if ($^O eq 'VMS') {
print "ok 9\n";
print "ok 10\n";
+ print "ok 11\n";
+ print "ok 12\n";
exit;
}
@@ -109,3 +113,21 @@ elsif ($? == 0) {
else {
print "ok 10\n";
}
+
+# check that status for the correct process is collected
+my $zombie = fork or exit 37;
+my $pipe = open *FH, "sleep 2;exit 13|" or die "Open: $!\n";
+$SIG{ALRM} = sub { return };
+alarm(1);
+my $close = close FH;
+if ($? == 13*256 && ! length $close && ! $!) {
+ print "ok 11\n";
+} else {
+ print "not ok 11\n# close $close\$?=$? \$!=", $!+0, ":$!\n";
+};
+my $wait = wait;
+if ($? == 37*256 && $wait == $zombie && ! $!) {
+ print "ok 12\n";
+} else {
+ print "not ok 12\n# pid=$wait \$?=$? \$!=", $!+0, ":$!\n";
+}