user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] spawnpp: use native perl %ENV outside of mod_perl
@ 2016-05-03  9:12 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-05-03  9:12 UTC (permalink / raw)
  To: meta

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.
---
 lib/PublicInbox/SpawnPP.pm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm
index dc2ef36..fe95d12 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;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-03  9:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03  9:12 [PATCH] spawnpp: use native perl %ENV outside of mod_perl Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).