From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 17FAE63382E for ; Mon, 29 Feb 2016 01:41:12 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 7/8] spawnpp: use env(1) for mod_perl compatibility Date: Mon, 29 Feb 2016 01:41:06 +0000 Message-Id: <20160229014107.7396-8-e@80x24.org> In-Reply-To: <20160229014107.7396-1-e@80x24.org> References: <20160229014107.7396-1-e@80x24.org> List-Id: We cannot modify %ENV directly under mod_perl (even after forking!), so use env(1) instead to pass the environment. --- lib/PublicInbox/SpawnPP.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/SpawnPP.pm b/lib/PublicInbox/SpawnPP.pm index 288625d..dc2ef36 100644 --- a/lib/PublicInbox/SpawnPP.pm +++ b/lib/PublicInbox/SpawnPP.pm @@ -19,13 +19,8 @@ sub public_inbox_fork_exec ($$$$$$) { if ($err != 2) { dup2($err, 2) or die "dup2 failed for stderr: $!"; } - %ENV = (); - foreach my $e (@$env) { - my ($k, $v) = split('=', $e, 2); - $ENV{$k} = $v; - } - exec @$cmd; - die "exec $cmd->[0] failed: $!\n"; + exec qw(env -i), @$env, @$cmd; + die "exec env -i ... $cmd->[0] failed: $!\n"; } $pid; } -- EW