about summary refs log tree commit homepage
path: root/lib/PublicInbox/XapHelper.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-31 20:34:51 +0000
committerEric Wong <e@80x24.org>2023-11-01 07:08:05 +0000
commit1cbebe89b46091ef7f9f64e6bbda98f82cff2dd7 (patch)
treeddf96e1be71cb56c15ff2619b00428912bc5f671 /lib/PublicInbox/XapHelper.pm
parent20b12985e9deda56f1a0de4a16d99e3ac389a6d4 (diff)
downloadpublic-inbox-1cbebe89b46091ef7f9f64e6bbda98f82cff2dd7.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/XapHelper.pm')
-rw-r--r--lib/PublicInbox/XapHelper.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm
index 55080abf..f7640f4c 100644
--- a/lib/PublicInbox/XapHelper.pm
+++ b/lib/PublicInbox/XapHelper.pm
@@ -179,11 +179,13 @@ sub recv_loop {
         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();