]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SpawnPP.pm
spawn_pp: use `which()' properly for pure-Perl spawn
[public-inbox.git] / lib / PublicInbox / SpawnPP.pm
index 7a5793f621ea710cf8c7fbc0b4f7cb37e8a2e087..73859e9b11ecf9882bf7045db0e31005ba5fdb8c 100644 (file)
@@ -3,9 +3,11 @@
 
 # Pure-Perl implementation of "spawn".  This can't take advantage
 # of vfork, so no speedups under Linux for spawning from large processes.
+# Do not require this directly, only use from PublicInbox::Spawn
 package PublicInbox::SpawnPP;
 use v5.12;
 use POSIX qw(dup2 _exit setpgid :signal_h);
+use PublicInbox::Spawn qw(which);
 
 # Pure Perl implementation for folks that do not use Inline::C
 sub pi_fork_exec ($$$$$$$) {
@@ -46,7 +48,8 @@ sub pi_fork_exec ($$$$$$$) {
                sigprocmask(SIG_SETMASK, $old) or die "SIG_SETMASK ~CHLD: $!";
                $cmd->[0] = $f;
                if ($ENV{MOD_PERL}) {
-                       @$cmd = (which('env'), '-i', @$env, @$cmd);
+                       $f = which('env');
+                       @$cmd = ('env', '-i', @$env, @$cmd);
                } else {
                        %ENV = map { split(/=/, $_, 2) } @$env;
                }