about summary refs log tree commit homepage
path: root/lib/PublicInbox/Config.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-04-29 03:43:20 +0000
committerEric Wong <e@80x24.org>2014-04-29 03:43:20 +0000
commit19703e2d72b045ec532f6725bea4adea5e8f3cf7 (patch)
treefd7ccce04990de330de645077b4856177583182d /lib/PublicInbox/Config.pm
parentb79559bb07595e5e29f45d5791bfb53cb6f6a06b (diff)
downloadpublic-inbox-19703e2d72b045ec532f6725bea4adea5e8f3cf7.tar.gz
%ENV changes do not propagate by default under a mod_perl2
environment, and we might as well work towards being thread-safe.
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r--lib/PublicInbox/Config.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 32bd9ab6..876e5d02 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -4,19 +4,19 @@ package PublicInbox::Config;
 use strict;
 use warnings;
 use File::Path::Expand qw/expand_filename/;
+use IPC::Run;
 
 # returns key-value pairs of config directives in a hash
 # if keys may be multi-value, the value is an array ref containing all values
 sub new {
         my ($class, $file) = @_;
+        my ($in, $out);
 
-        local $ENV{GIT_CONFIG} = defined $file ? $file : default_file();
-
-        my @cfg = `git config -l`;
-        $? == 0 or die "git config -l failed: $?\n";
-        chomp @cfg;
+        $file = default_file() unless defined($file);
+        IPC::Run::run([qw/git config --file/, $file, '-l'], \$in, \$out);
+        $? == 0 or die "git config --file $file -l failed: $?\n";
         my %rv;
-        foreach my $line (@cfg) {
+        foreach my $line (split(/\n/, $out)) {
                 my ($k, $v) = split(/=/, $line, 2);
                 my $cur = $rv{$k};