Skip to content

Commit

Permalink
Fix test file per George Greer comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeenan committed Jun 21, 2014
1 parent 30962f6 commit d3ae482
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions ext/IPC-Open3/t/IPC-Open3.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BEGIN {
}

use strict;
use Test::More tests => 38;
use Test::More tests => 44;

use IO::Handle;
use IPC::Open3;
Expand Down Expand Up @@ -188,29 +188,33 @@ 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;
# }
#}
# 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.
{
if (&IPC::Open3::DO_SPAWN) {
skip "Calling open3 with tied filehandles does not work here", 6
}

{ # 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;
}
}

0 comments on commit d3ae482

Please sign in to comment.