diff options
author | Dmitri Tikhonov <dmitri@cpan.org> | 2014-06-07 00:23:50 -0400 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2014-06-21 12:37:39 +0200 |
commit | 04e0f0c28a521a290f29301e7b2abe43d65a5339 (patch) | |
tree | 5c9adb34e5ed2559227495a95dead35e97f54b58 /ext/IPC-Open3 | |
parent | c5aea1955a29bc7e8ef53eb3dd271fdacff597f3 (diff) | |
download | perl-04e0f0c28a521a290f29301e7b2abe43d65a5339.tar.gz |
Untie STDERR in IPC::Open3.
Add Dmitri Tikhonov to Perl 5 AUTHORS.
Increment IPC/Open3.pm $VERSION.
For: RT #119843, originally reported by A.N.
Diffstat (limited to 'ext/IPC-Open3')
-rw-r--r-- | ext/IPC-Open3/lib/IPC/Open3.pm | 3 | ||||
-rw-r--r-- | ext/IPC-Open3/t/IPC-Open3.t | 29 |
2 files changed, 30 insertions, 2 deletions
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm index c8620b77ae..99f120b6f9 100644 --- a/ext/IPC-Open3/lib/IPC/Open3.pm +++ b/ext/IPC-Open3/lib/IPC/Open3.pm @@ -9,7 +9,7 @@ require Exporter; use Carp; use Symbol qw(gensym qualify); -$VERSION = '1.16'; +$VERSION = '1.17'; @ISA = qw(Exporter); @EXPORT = qw(open3); @@ -246,6 +246,7 @@ sub _open3 { # A tie in the parent should not be allowed to cause problems. untie *STDIN; untie *STDOUT; + untie *STDERR; close $stat_r; require Fcntl; diff --git a/ext/IPC-Open3/t/IPC-Open3.t b/ext/IPC-Open3/t/IPC-Open3.t index 6ab519d002..05aeb4ab3c 100644 --- a/ext/IPC-Open3/t/IPC-Open3.t +++ b/ext/IPC-Open3/t/IPC-Open3.t @@ -14,7 +14,7 @@ BEGIN { } use strict; -use Test::More tests => 38; +use Test::More tests => 44; use IO::Handle; use IPC::Open3; @@ -187,3 +187,30 @@ foreach my $handle (qw (DUMMY STDIN STDOUT STDERR)) { } waitpid $pid, 0; } + +# Test that tied STDIN, STDOUT, and STDERR do not cause open3 any discomfort. +# In particular, tied STDERR used to be able to prevent open3 from working +# correctly. RT #119843. +{ + { # This just throws things out + package My::Tied::FH; + sub TIEHANDLE { bless \my $self } + sub PRINT {} + # Note the absence of OPEN and FILENO + } + my $message = "japh\n"; + foreach my $handle (*STDIN, *STDOUT, *STDERR) { + tie $handle, 'My::Tied::FH'; + my ($in, $out); + my $pid = eval { + open3 $in, $out, undef, $perl, '-ne', 'print'; + }; + is($@, '', "no errors calling open3 with tied $handle"); + print $in $message; + close $in; + my $japh = <$out>; + waitpid $pid, 0; + is($japh, $message, "read input correctly"); + untie $handle; + } +} |