From: Eric Wong Date: Tue, 19 Jan 2021 09:34:30 +0000 (+0000) Subject: lei: write daemon errors to the sock directory X-Git-Tag: v1.7.0~1347 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=15bed10a92def9645d81ccb319f285e927dc3327;p=public-inbox.git lei: write daemon errors to the sock directory 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. --- 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;