about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-19 09:34:30 +0000
committerEric Wong <e@80x24.org>2021-01-21 03:29:10 +0000
commit15bed10a92def9645d81ccb319f285e927dc3327 (patch)
tree67da8bf8d67c1a385a4cdfe4e71e3df2b121ef6b
parent02afba361b5705d233ea9a92ee235d2d5122d6b8 (diff)
downloadpublic-inbox-15bed10a92def9645d81ccb319f285e927dc3327.tar.gz
Most everything should be captured by the __WARN__ handlers and
routed to syslog, but it appears Perl may write to stderr in
some emergency cases, as can libc or other libraries.  Just
point it to a small file that's cleared on reboot.
-rw-r--r--lib/PublicInbox/LEI.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 802d2cd9..e4f8bedb 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -830,7 +830,9 @@ sub lazy_start {
         require PublicInbox::Listener;
         require PublicInbox::EOFpipe;
         (-p STDOUT) or die "E: stdout must be a pipe\n";
-        open(STDIN, '+<', '/dev/null') or die "redirect stdin failed: $!";
+        my ($err) = ($path =~ m!\A(.+?/)[^/]+\z!);
+        $err .= 'errors.log';
+        open(STDIN, '+>>', $err) or die "open($err): $!";
         POSIX::setsid() > 0 or die "setsid: $!";
         my $pid = fork // die "fork: $!";
         return if $pid;