about summary refs log tree commit homepage
path: root/lib/PublicInbox/Gcf2Client.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-01 09:54:27 +0000
committerEric Wong <e@80x24.org>2023-10-01 22:41:48 +0000
commitb231d91f42d791becf7b6861e723833d71e73237 (patch)
tree02e4efac6c8af7b1735f5e75cb0c7209c57e998d /lib/PublicInbox/Gcf2Client.pm
parent3b8315e371c322ff59b31b36b14d9b7568e708fe (diff)
downloadpublic-inbox-b231d91f42d791becf7b6861e723833d71e73237.tar.gz
While forked processes inherit from the parent, exec-ed
processes need the `-w' flag passed to them.  To determine
whether or not we should pass them, we must check the `$^W'
global perlvar, first.

We'll also favor `perl -e' over `perl -E' in places where
we don't rely on the latest features, since `-E' incurs
slightly more startup time overhead from loading feature.pm
(while `perl -Mv5.12' does not).
Diffstat (limited to 'lib/PublicInbox/Gcf2Client.pm')
-rw-r--r--lib/PublicInbox/Gcf2Client.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/Gcf2Client.pm b/lib/PublicInbox/Gcf2Client.pm
index 8e313c84..4a0348b4 100644
--- a/lib/PublicInbox/Gcf2Client.pm
+++ b/lib/PublicInbox/Gcf2Client.pm
@@ -30,7 +30,8 @@ sub new  {
         socketpair(my $s1, my $s2, AF_UNIX, SOCK_STREAM, 0);
         $s1->blocking(0);
         $opt->{0} = $opt->{1} = $s2;
-        my $cmd = [$^X, qw[-MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop]];
+        my $cmd = [$^X, $^W ? ('-w') : (),
+                        qw[-MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop]];
         my $pid = spawn($cmd, $env, $opt);
         my $sock = PublicInbox::ProcessPipe->maybe_new($pid, $s1);
         $self->{inflight} = [];