summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-15 12:40:41 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-15 12:40:41 -0700
commitd809d050ffe332cdd91281ad6b01e8363e417ec8 (patch)
treeb48d5bd19a7cd6008d01488cf396b5f3fe208178 /perl
parent85e7e81ccfcec98972e341ab81b0109084b84906 (diff)
parenta749c0bbef068af339ea1ac8843f8ca307b3dd35 (diff)
downloadgit-d809d050ffe332cdd91281ad6b01e8363e417ec8.tar.gz
Merge branch 'tr/perl-keep-stderr-open'
Closing (not redirecting to /dev/null) the standard error stream is not a very smart thing to do. Later open may return file descriptor #2 for unrelated purpose, and error reporting code may write into them. * tr/perl-keep-stderr-open: t9700: do not close STDERR perl: redirect stderr to /dev/null instead of closing
Diffstat (limited to 'perl')
-rw-r--r--perl/Git.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index 650db90853..dc48159cca 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -1489,12 +1489,12 @@ sub _command_common_pipe {
if (not defined $pid) {
throw Error::Simple("open failed: $!");
} elsif ($pid == 0) {
- if (defined $opts{STDERR}) {
- close STDERR;
- }
if ($opts{STDERR}) {
open (STDERR, '>&', $opts{STDERR})
or die "dup failed: $!";
+ } elsif (defined $opts{STDERR}) {
+ open (STDERR, '>', '/dev/null')
+ or die "opening /dev/null failed: $!";
}
_cmd_exec($self, $cmd, @args);
}