about summary refs log tree commit homepage
path: root/lib/PublicInbox/IPC.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-09 07:09:37 -0100
committerEric Wong <e@80x24.org>2021-02-10 06:59:10 +0000
commit04b73104416e4734b3a01e47525119cac867065a (patch)
tree90d90646330fe572e0dc96317fdc9eb2003c5d5f /lib/PublicInbox/IPC.pm
parent0c32dadfb508e087111fb4d685add5a22e5f6cd1 (diff)
downloadpublic-inbox-04b73104416e4734b3a01e47525119cac867065a.tar.gz
DESTROY callbacks can clobber $?, so we must take care to
preserve it when exiting.  We'll also try to make an effort to
ensure better DESTROY ordering and delete as much as possible
before x_it finishes.

We also need to load PublicInbox::Config when setting up
public inboxes.
Diffstat (limited to 'lib/PublicInbox/IPC.pm')
-rw-r--r--lib/PublicInbox/IPC.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm
index 9331233a..efac4c4d 100644
--- a/lib/PublicInbox/IPC.pm
+++ b/lib/PublicInbox/IPC.pm
@@ -412,9 +412,11 @@ sub DESTROY {
         my ($self) = @_;
         my $ppid = $self->{-wq_ppid};
         wq_kill($self) if $ppid && $ppid == $$;
+        my $err = $?;
         wq_close($self);
         wq_wait_old($self);
         ipc_worker_stop($self);
+        $? = $err if $err;
 }
 
 sub detect_nproc () {