about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/TestCommon.pm6
-rw-r--r--lib/PublicInbox/Xapcmd.pm6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 6e3e9d8c..e9efbac7 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -319,8 +319,9 @@ sub kill {
 }
 
 sub join {
-        my ($self) = @_;
+        my ($self, $sig) = @_;
         my $pid = delete $self->{pid} or return;
+        CORE::kill($sig, $pid) if defined $sig;
         my $ret = waitpid($pid, 0);
         defined($ret) or die "waitpid($pid): $!";
         $ret == $pid or die "waitpid($pid) != $ret";
@@ -333,8 +334,7 @@ sub DESTROY {
                 PublicInbox::TestCommon::wait_for_tail();
                 CORE::kill('TERM', $tail);
         }
-        my $pid = delete $self->{pid} or return;
-        CORE::kill('TERM', $pid);
+        $self->join('TERM');
 }
 
 1;
diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm
index 8e2b9063..337978bd 100644
--- a/lib/PublicInbox/Xapcmd.pm
+++ b/lib/PublicInbox/Xapcmd.pm
@@ -142,7 +142,11 @@ sub process_queue {
                 while (scalar keys %pids) {
                         my $pid = waitpid(-1, 0);
                         my $args = delete $pids{$pid};
-                        die join(' ', @$args)." failed: $?\n" if $?;
+                        if ($args) {
+                                die join(' ', @$args)." failed: $?\n" if $?;
+                        } else {
+                                warn "unknown PID($pid) reaped: $?\n";
+                        }
                 }
         }
 }