]> Sergey Matveev's repositories - public-inbox.git/commitdiff
spawnpp: use absolute path for exec
authorEric Wong <e@80x24.org>
Tue, 24 Sep 2019 03:39:03 +0000 (03:39 +0000)
committerEric Wong <e@80x24.org>
Tue, 24 Sep 2019 03:39:03 +0000 (03:39 +0000)
We support "-env" to clear the environment with spawn(),
which causes test failures but no runtime failures
(since "-env" isn't used anywhere in our real code)

Reported-and-tested-by: Alyssa Ross <hi@alyssa.is>
lib/PublicInbox/SpawnPP.pm

index 25c8c87fd86747ffb9fb7466cd4223d83419813a..29b1337103f59c164a6bd1c2fe79ea2d125cc743 100644 (file)
@@ -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";
                }
        }