From: Eric Wong Date: Tue, 24 Sep 2019 03:39:03 +0000 (+0000) Subject: spawnpp: use absolute path for exec X-Git-Tag: v1.2.0~77 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=4b3e278d9c4e5d1f55c1781aa0a7c9f0453f3852 spawnpp: use absolute path for exec 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 --- diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm index 25c8c87f..29b13371 100644 --- a/lib/PublicInbox/SpawnPP.pm +++ b/lib/PublicInbox/SpawnPP.pm @@ -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"; } }