Another attempt at doing what commit
35de8fdcbf290e25
(xap_helper.pm: quiet undefined warnings at shutdown, 2023-10-23)
tried to do. It turns out perl croaks (not warn/carp) when it sees
an undefined file handle, here.
local $SIG{TERM} = sub { undef $in };
while (defined($in)) {
PublicInbox::DS::sig_setmask($workerset);
- my @fds = do { # we undef $in in SIG{TERM}
- no strict 'refs';
- no warnings 'uninitialized';
+ my @fds = eval { # we undef $in in SIG{TERM}
$PublicInbox::IPC::recv_cmd->($in, $rbuf, 4096*33)
};
+ if ($@) {
+ exit if !$in; # hit by SIGTERM
+ die;
+ }
scalar(@fds) or exit(66); # EX_NOINPUT
die "recvmsg: $!" if !defined($fds[0]);
PublicInbox::DS::block_signals();