In the POD docs it says:
"The filehandles may also be integers, in which case they are under-
stood as file descriptors."
However IPC::Open3 doesn't handle the file descriptors correctly.
As an example, if we try to dup STDIN in a child process by using it's
file descriptor, we get:
> perl -MIPC::Open3 -wle 'open3("<&1", my $out, undef, $^X)'
close() on unopened filehandle 1 at /usr/share/perl/5.10/IPC/Open3.pm line 70.
open3: close(1) failed: Bad file descriptor at -e line 1
This is because in IPC::Open3 the subroutines xpipe*, xclose* and
xopen don't cater for descriptors being passed in instead of
filehandles.
}
sub xclose {
- close $_[0] or croak "$Me: close($_[0]) failed: $!";
+ $_[0] =~ /\A=?(\d+)\z/ ? eval { require POSIX; POSIX::close($1); } : close $_[0]
}
sub fh_is_fd {