about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-02-28 04:23:53 +0000
committerEric Wong <e@80x24.org>2016-04-05 18:58:27 +0000
commit38f685ef4c78788324089f9d1365c7676aa5a5aa (patch)
treeab59ac603dc6230715542170bc789bbc6c1d5a71 /lib/PublicInbox/Git.pm
parent74bdccb25e66298c3f9c81af0f611ad3adfc5a01 (diff)
downloadpublic-inbox-38f685ef4c78788324089f9d1365c7676aa5a5aa.tar.gz
We want to be able to redirect stderr to a temporary file
while using the normal popen interface in our Git.pm.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 23a3e6c7..bd945007 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -132,8 +132,16 @@ sub fail {
 
 sub popen {
         my ($self, @cmd) = @_;
-        @cmd = ('git', "--git-dir=$self->{git_dir}", @cmd);
-        popen_rd(\@cmd);
+        my $cmd = [ 'git', "--git-dir=$self->{git_dir}" ];
+        my ($env, $opt);
+        if (ref $cmd[0]) {
+                push @$cmd, @{$cmd[0]};
+                $env = $cmd[1];
+                $opt = $cmd[2];
+        } else {
+                push @$cmd, @cmd;
+        }
+        popen_rd($cmd, $env, $opt);
 }
 
 sub qx {