|
@@ -282,7 +282,8 @@ sub spawn {
|
|
|
} elsif ($opts{from_handle}) {
|
|
} elsif ($opts{from_handle}) {
|
|
|
open(STDIN, '<&', $opts{from_handle})
|
|
open(STDIN, '<&', $opts{from_handle})
|
|
|
or syserr(g_('reopen stdin'));
|
|
or syserr(g_('reopen stdin'));
|
|
|
- close($opts{from_handle}); # has been duped, can be closed
|
|
|
|
|
|
|
+ # has been duped, can be closed
|
|
|
|
|
+ push @{$opts{close_in_child}}, $opts{from_handle};
|
|
|
}
|
|
}
|
|
|
# Redirect STDOUT if needed
|
|
# Redirect STDOUT if needed
|
|
|
if ($opts{to_file}) {
|
|
if ($opts{to_file}) {
|
|
@@ -291,7 +292,8 @@ sub spawn {
|
|
|
} elsif ($opts{to_handle}) {
|
|
} elsif ($opts{to_handle}) {
|
|
|
open(STDOUT, '>&', $opts{to_handle})
|
|
open(STDOUT, '>&', $opts{to_handle})
|
|
|
or syserr(g_('reopen stdout'));
|
|
or syserr(g_('reopen stdout'));
|
|
|
- close($opts{to_handle}); # has been duped, can be closed
|
|
|
|
|
|
|
+ # has been duped, can be closed
|
|
|
|
|
+ push @{$opts{close_in_child}}, $opts{to_handle};
|
|
|
}
|
|
}
|
|
|
# Redirect STDERR if needed
|
|
# Redirect STDERR if needed
|
|
|
if ($opts{error_to_file}) {
|
|
if ($opts{error_to_file}) {
|
|
@@ -300,7 +302,8 @@ sub spawn {
|
|
|
} elsif ($opts{error_to_handle}) {
|
|
} elsif ($opts{error_to_handle}) {
|
|
|
open(STDERR, '>&', $opts{error_to_handle})
|
|
open(STDERR, '>&', $opts{error_to_handle})
|
|
|
or syserr(g_('reopen stdout'));
|
|
or syserr(g_('reopen stdout'));
|
|
|
- close($opts{error_to_handle}); # has been duped, can be closed
|
|
|
|
|
|
|
+ # has been duped, can be closed
|
|
|
|
|
+ push @{$opts{close_in_child}}, $opts{error_to_handle};
|
|
|
}
|
|
}
|
|
|
# Close some inherited filehandles
|
|
# Close some inherited filehandles
|
|
|
close($_) foreach (@{$opts{close_in_child}});
|
|
close($_) foreach (@{$opts{close_in_child}});
|