my @close;
if ($dup_wtr) {
- $kid_rdr = \*{$dad_wtr};
+ $kid_rdr = $dad_wtr =~ /\A[0-9]+\z/ ? $dad_wtr : \*{$dad_wtr};
push @close, $kid_rdr;
} else {
push @close, \*{$dad_wtr}, $kid_rdr;
}
if ($dup_rdr) {
- $kid_wtr = \*{$dad_rdr};
+ $kid_wtr = $dad_rdr =~ /\A[0-9]+\z/ ? $dad_rdr : \*{$dad_rdr};
push @close, $kid_wtr;
} else {
push @close, \*{$dad_rdr}, $kid_wtr;
}
if ($dad_rdr ne $dad_err) {
if ($dup_err) {
- $kid_err = \*{$dad_err};
+ $kid_err = $dad_err =~ /\A[0-9]+\z/ ? $dad_err : \*{$dad_err};
push @close, $kid_err;
} else {
push @close, \*{$dad_err}, $kid_err;
use strict;
use warnings;
-plan 1;
+plan 3;
# [perl #76474]
{
is $stderr, '',
"dup STDOUT in a child process by using its file descriptor";
}
+
+{
+ my $want = qr/\A# This Makefile is for the IPC::Open3 extension to perl\.\r?\z/;
+ open my $fh, '<', 'Makefile' or die "Can't open MAKEFILE: $!";
+ my $have = <$fh>;
+ chomp $have;
+ like($have, $want, 'No surprises from MakeMaker');
+ close $fh;
+
+ fresh_perl_like(<<'EOP',
+use IPC::Open3;
+open FOO, 'Makefile' or die $!;
+open3('<&' . fileno FOO, my $out, undef, $ENV{PERLEXE}, '-eprint scalar <STDIN>');
+print <$out>;
+EOP
+ $want,
+ undef,
+ 'Numeric file handles are duplicated correctly'
+ );
+}
Fixes a bug which prevented use of open3 on Windows when *STDIN, *STDOUT or
*STDERR had been localized.
+=item *
+
+Fixes a bug which prevented duplicating numeric file descriptors on Windows.
+
=back
=item *