about summary refs log tree commit homepage
path: root/lib/PublicInbox/SpawnPP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-30 05:04:15 +0000
committerEric Wong <e@80x24.org>2019-12-30 17:52:17 +0000
commit30afcadb13f446c99952883bbaa54e102757b682 (patch)
treeb247308fe5c626e23a4e6d97291ca75d6c4ddfc5 /lib/PublicInbox/SpawnPP.pm
parent267371b1273b518215939e817e53733584b68af7 (diff)
downloadpublic-inbox-30afcadb13f446c99952883bbaa54e102757b682.tar.gz
This simplifies our admin module a bit and allows solver to be
used with v1 inboxes using git versions prior to v1.8.5 (but
still >= git v1.8.0).
Diffstat (limited to 'lib/PublicInbox/SpawnPP.pm')
-rw-r--r--lib/PublicInbox/SpawnPP.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm
index 2ac02c56..cd682a6b 100644
--- a/lib/PublicInbox/SpawnPP.pm
+++ b/lib/PublicInbox/SpawnPP.pm
@@ -9,8 +9,8 @@ use warnings;
 use POSIX qw(dup2 :signal_h);
 
 # Pure Perl implementation for folks that do not use Inline::C
-sub pi_fork_exec ($$$$$) {
-        my ($redir, $f, $cmd, $env, $rlim) = @_;
+sub pi_fork_exec ($$$$$$) {
+        my ($redir, $f, $cmd, $env, $rlim, $cd) = @_;
         my $old = POSIX::SigSet->new();
         my $set = POSIX::SigSet->new();
         $set->fillset or die "fillset failed: $!";
@@ -33,6 +33,9 @@ sub pi_fork_exec ($$$$$) {
                         dup2($parent_fd, $child_fd) or
                                 die "dup2($parent_fd, $child_fd): $!\n";
                 }
+                if ($cd ne '') {
+                        chdir $cd or die "chdir $cd: $!";
+                }
                 if ($ENV{MOD_PERL}) {
                         exec which('env'), '-i', @$env, @$cmd;
                         die "exec env -i ... $cmd->[0] failed: $!\n";