about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-23 01:17:28 +0000
committerEric Wong <e@80x24.org>2016-05-23 01:17:28 +0000
commite8e1aba1abd87dacfe46704a9e939f13c9ad3b52 (patch)
tree25c60471d3880f205d9f3363e972b8046b4967ff
parentbe5bef0258b12a249f947b49f23c08f42b1741e3 (diff)
downloadpublic-inbox-e8e1aba1abd87dacfe46704a9e939f13c9ad3b52.tar.gz
We may spawn this in a large server process, so be sure
to take advantage of the optional vfork() support when
for folks who set PERL_INLINE_DIRECTORY.
-rw-r--r--lib/PublicInbox/Config.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index b38f4443..935b0445 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -8,6 +8,7 @@ use warnings;
 use base qw/Exporter/;
 our @EXPORT_OK = qw/try_cat/;
 require PublicInbox::Inbox;
+use PublicInbox::Spawn qw(popen_rd);
 use File::Path::Expand qw/expand_filename/;
 
 # returns key-value pairs of config directives in a hash
@@ -77,8 +78,7 @@ sub git_config_dump {
         my ($in, $out);
         my @cmd = (qw/git config/, "--file=$file", '-l');
         my $cmd = join(' ', @cmd);
-        my $pid = open(my $fh, '-|', @cmd);
-        defined $pid or die "$cmd failed: $!";
+        my $fh = popen_rd(\@cmd);
         my %rv;
         local $/ = "\n";
         foreach my $line (<$fh>) {
@@ -96,8 +96,7 @@ sub git_config_dump {
                         $rv{$k} = $v;
                 }
         }
-        close $fh or die "failed to close ($cmd) pipe: $!";
-        $? and warn "$$ $cmd exited with: ($pid) $?";
+        close $fh or die "failed to close ($cmd) pipe: $?";
         \%rv;
 }