about summary refs log tree commit homepage
path: root/script
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 /script
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 'script')
-rwxr-xr-xscript/lei4
1 files changed, 2 insertions, 2 deletions
diff --git a/script/lei b/script/lei
index a77ea880..1d90be0a 100755
--- a/script/lei
+++ b/script/lei
@@ -92,8 +92,8 @@ my $addr = pack_sockaddr_un($path);
 socket($sock, AF_UNIX, SOCK_SEQPACKET, 0) or die "socket: $!";
 unless (connect($sock, $addr)) { # start the daemon if not started
         local $ENV{PERL5LIB} = join(':', @INC);
-        open(my $daemon, '-|', $^X, qw[-MPublicInbox::LEI
-                -E PublicInbox::LEI::lazy_start(@ARGV)],
+        open(my $daemon, '-|', $^X, $^W ? ('-w') : (),
+                qw[-MPublicInbox::LEI -e PublicInbox::LEI::lazy_start(@ARGV)],
                 $path, $! + 0, $narg) or die "popen: $!";
         while (<$daemon>) { warn $_ } # EOF when STDERR is redirected
         close($daemon) or warn <<"";