about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-10 12:15:03 +0000
committerEric Wong <e@80x24.org>2021-01-12 03:51:42 +0000
commit9fd84b74b80eb98855d57f438e88ba9285b3d9a6 (patch)
tree5a56455b7807f63c1377a44c1a9dd7f6e6d3bc4a
parentc17c44d9e0ef28f0f0521656f335f836ad8b7754 (diff)
downloadpublic-inbox-9fd84b74b80eb98855d57f438e88ba9285b3d9a6.tar.gz
We should not need an eval for warning with our code base.
Nowadays, dwaitpid() automatically does the right thing
regardless of whether we're in the event loop, so no eval
is needed there, either.
-rw-r--r--lib/PublicInbox/IPC.pm12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm
index 7dc8ec6a..5082f110 100644
--- a/lib/PublicInbox/IPC.pm
+++ b/lib/PublicInbox/IPC.pm
@@ -69,7 +69,7 @@ sub ipc_worker_loop ($$$) {
                 # this is the overwhelmingly likely case
                 if (!defined($wantarray)) {
                         eval { $self->$sub(@args) };
-                        eval { warn "$$ die: $@ (from nowait $sub)\n" } if $@;
+                        warn "$$ die: $@ (from nowait $sub)\n" if $@;
                 } elsif ($wantarray) {
                         my @ret = eval { $self->$sub(@args) };
                         ipc_return($w_res, \@ret, $@);
@@ -144,15 +144,7 @@ sub ipc_worker_stop {
 
         # allow any sibling to send ipc_worker_exit, but siblings can't wait
         return if $$ != $ppid;
-        eval {
-                my $reap = $self->can('ipc_worker_reap');
-                PublicInbox::DS::dwaitpid($pid, $reap, $self);
-        };
-        if ($@) {
-                my $wp = waitpid($pid, 0);
-                $pid == $wp or die "waitpid($pid) returned $wp: \$?=$?";
-                $self->ipc_worker_reap($pid);
-        }
+        PublicInbox::DS::dwaitpid($pid, \&ipc_worker_reap, $self);
 }
 
 # use this if we have multiple readers reading curl or "pigz -dc"