diff options
author | Eric Wong <e@80x24.org> | 2016-05-03 06:20:54 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-05-03 07:19:19 +0000 |
commit | 2e4250880849e2f08cb58a8708952fcd8a4a6e54 (patch) | |
tree | 7cb873b5f137a203fc513a822ebb453cc32b163d | |
parent | 244d950c2f2f31ad1de2151b5b0d30651e586150 (diff) | |
download | public-inbox-2e4250880849e2f08cb58a8708952fcd8a4a6e54.tar.gz |
We only need to use env(1) under mod_perl; since mod_perl is uncommon nowadays, support native %ENV for a teeny speedup for folks uncomfortable with running vfork via Inline::C snippet.
-rw-r--r-- | lib/PublicInbox/SpawnPP.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm index dc2ef364..fe95d126 100644 --- a/lib/PublicInbox/SpawnPP.pm +++ b/lib/PublicInbox/SpawnPP.pm @@ -19,8 +19,15 @@ sub public_inbox_fork_exec ($$$$$$) { if ($err != 2) { dup2($err, 2) or die "dup2 failed for stderr: $!"; } - exec qw(env -i), @$env, @$cmd; - die "exec env -i ... $cmd->[0] failed: $!\n"; + + if ($ENV{MOD_PERL}) { + exec qw(env -i), @$env, @$cmd; + die "exec env -i ... $cmd->[0] failed: $!\n"; + } else { + local %ENV = map { split(/=/, $_, 2) } @$env; + exec @$cmd; + die "exec $cmd->[0] failed: $!\n"; + } } $pid; } |