summaryrefslogtreecommitdiff
path: root/ext/IPC-Open3
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-06-06 19:48:03 +0200
committerNicholas Clark <nick@ccl4.org>2011-06-11 08:48:16 +0200
commitcae0d2696383fe61e20cd1cd2c994c1d8e4f5512 (patch)
tree4e52a276e6abeed0bf7b37e4fef646c619c9a9d1 /ext/IPC-Open3
parentf2412f8992265c5e91329c250ba4711946a5e321 (diff)
downloadperl-cae0d2696383fe61e20cd1cd2c994c1d8e4f5512.tar.gz
In IPC::Open3::_open(), switch from 'r' and 'w' to '<' and '>'.
IO::Handle accepts either, but open only accepts the latter. In spawn_with_handles(), hoist the C<require Fcntl> into the only block that needs it - this avoids loading Fcntl on Win32.
Diffstat (limited to 'ext/IPC-Open3')
-rw-r--r--ext/IPC-Open3/lib/IPC/Open3.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index c57a306ed2..25601767cd 100644
--- a/ext/IPC-Open3/lib/IPC/Open3.pm
+++ b/ext/IPC-Open3/lib/IPC/Open3.pm
@@ -214,9 +214,9 @@ sub _open3 {
croak "$Me: $@";
}
- my @handles = ({ mode => 'r', handle => \*STDIN },
- { mode => 'w', handle => \*STDOUT },
- { mode => 'w', handle => \*STDERR },
+ my @handles = ({ mode => '<', handle => \*STDIN },
+ { mode => '>', handle => \*STDOUT },
+ { mode => '>', handle => \*STDERR },
);
foreach (@handles) {
@@ -383,7 +383,6 @@ sub spawn_with_handles {
my $fds = shift; # Fields: handle, mode, open_as
my $close_in_child = shift;
my ($fd, $pid, @saved_fh, $saved, %saved, @errs);
- require Fcntl;
foreach $fd (@$fds) {
$fd->{tmp_copy} = IO::Handle->new_from_fd($fd->{handle}, $fd->{mode});
@@ -400,6 +399,7 @@ sub spawn_with_handles {
$fd->{mode});
}
unless ($^O eq 'MSWin32') {
+ require Fcntl;
# Stderr may be redirected below, so we save the err text:
foreach $fd (@$close_in_child) {
next unless fileno $fd;