diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-26 02:11:31 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-07-26 02:11:31 +0000 |
commit | f2b5be74500fffd3dc232fca7cb3c51bc3b9abf9 (patch) | |
tree | 4ca90dcb7912cdbeb031dd0bba3a9b3f5b55ef72 /t | |
parent | a682de96b5260e75b40bb25b8d2eb16f338518c6 (diff) | |
download | perl-f2b5be74500fffd3dc232fca7cb3c51bc3b9abf9.tar.gz |
ensure implicitly closed handles don't set $? or $!
p4raw-id: //depot/perl@3752
Diffstat (limited to 't')
-rwxr-xr-x | t/io/pipe.t | 17 |
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; |