This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Untie STDERR in IPC::Open3.
authorDmitri Tikhonov <dmitri@cpan.org>
Sat, 7 Jun 2014 04:23:50 +0000 (00:23 -0400)
committerJames E Keenan <jkeenan@cpan.org>
Sat, 21 Jun 2014 10:37:39 +0000 (12:37 +0200)
Add Dmitri Tikhonov to Perl 5 AUTHORS.
Increment IPC/Open3.pm $VERSION.

For: RT #119843, originally reported by A.N.

AUTHORS
ext/IPC-Open3/lib/IPC/Open3.pm
ext/IPC-Open3/t/IPC-Open3.t

diff --git a/AUTHORS b/AUTHORS
index 4740185..177e64d 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -336,6 +336,7 @@ Devin Heitmueller           <devin.heitmueller@gmail.com>
 DH                             <crazyinsomniac@yahoo.com>
 Diab Jerius                    <dj@head-cfa.harvard.edu>
 dLux                           <dlux@spam.sch.bme.hu>
+Dmitri Tikhonov                        <dmitri@cpan.org>
 Dmitry Karasik                 <dk@tetsuo.karasik.eu.org>
 Dominic Dunlop                 <domo@computer.org>
 Dominic Hargreaves             <dom@earth.li>
index c8620b7..99f120b 100644 (file)
@@ -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;
index 6ab519d..05aeb4a 100644 (file)
@@ -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;
+    }
+}