]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/SpawnPP.pm
doc: avoid [<directory>] arg for git-clone(1)
[public-inbox.git] / lib / PublicInbox / SpawnPP.pm
index 8692b767571a1a26c0674a29a184502823e384ab..29b1337103f59c164a6bd1c2fe79ea2d125cc743 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Pure-Perl implementation of "spawn".  This can't take advantage
@@ -38,11 +38,13 @@ sub pi_fork_exec ($$$$$$) {
                }
 
                if ($ENV{MOD_PERL}) {
-                       exec qw(env -i), @$env, @$cmd;
+                       exec which('env'), '-i', @$env, @$cmd;
                        die "exec env -i ... $cmd->[0] failed: $!\n";
                } else {
                        local %ENV = map { split(/=/, $_, 2) } @$env;
-                       exec @$cmd;
+                       my @cmd = @$cmd;
+                       $cmd[0] = $f;
+                       exec @cmd;
                        die "exec $cmd->[0] failed: $!\n";
                }
        }