summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-07-26 02:11:31 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-07-26 02:11:31 +0000
commitf2b5be74500fffd3dc232fca7cb3c51bc3b9abf9 (patch)
tree4ca90dcb7912cdbeb031dd0bba3a9b3f5b55ef72 /t
parenta682de96b5260e75b40bb25b8d2eb16f338518c6 (diff)
downloadperl-f2b5be74500fffd3dc232fca7cb3c51bc3b9abf9.tar.gz
ensure implicitly closed handles don't set $? or $!
p4raw-id: //depot/perl@3752
Diffstat (limited to 't')
-rwxr-xr-xt/io/pipe.t17
1 files changed, 14 insertions, 3 deletions
diff --git a/t/io/pipe.t b/t/io/pipe.t
index 37949c4546..826cf7434a 100755
--- a/t/io/pipe.t
+++ b/t/io/pipe.t
@@ -1,7 +1,5 @@
#!./perl
-# $RCSfile: pipe.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:31 $
-
BEGIN {
chdir 't' if -d 't';
unshift @INC, '../lib';
@@ -13,7 +11,7 @@ BEGIN {
}
$| = 1;
-print "1..14\n";
+print "1..15\n";
# External program 'tr' assumed.
open(PIPE, "|-") || (exec 'tr', 'YX', 'ko');
@@ -158,3 +156,16 @@ if ($? == 37*256 && $wait == $zombie && ! $!) {
print (((open P, "| " ) ? "not " : ""), "ok 13\n");
print (((open P, " |" ) ? "not " : ""), "ok 14\n");
}
+
+# check that status is unaffected by implicit close
+{
+ local(*NIL);
+ open NIL, '|exit 23;' or die "fork failed: $!";
+ $? = 42;
+ # NIL implicitly closed here
+}
+if ($? != 42) {
+ print "# status $?, expected 42\nnot ";
+}
+print "ok 15\n";
+$? = 0;