In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/04e0f0c28a521a290f29301e7b2abe43d65a5339?hp=c5aea1955a29bc7e8ef53eb3dd271fdacff597f3>

- Log -----------------------------------------------------------------
commit 04e0f0c28a521a290f29301e7b2abe43d65a5339
Author: Dmitri Tikhonov <[email protected]>
Date:   Sat Jun 7 00:23:50 2014 -0400

    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.
-----------------------------------------------------------------------

Summary of changes:
 AUTHORS                        |  1 +
 ext/IPC-Open3/lib/IPC/Open3.pm |  3 ++-
 ext/IPC-Open3/t/IPC-Open3.t    | 29 ++++++++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 4740185..177e64d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -336,6 +336,7 @@ Devin Heitmueller           <[email protected]>
 DH                             <[email protected]>
 Diab Jerius                    <[email protected]>
 dLux                           <[email protected]>
+Dmitri Tikhonov                        <[email protected]>
 Dmitry Karasik                 <[email protected]>
 Dominic Dunlop                 <[email protected]>
 Dominic Hargreaves             <[email protected]>
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index c8620b7..99f120b 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 6ab519d..05aeb4a 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;
+    }
+}

--
Perl5 Master Repository

Reply via email to