]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: exit code in oneshot mode
authorEric Wong <e@80x24.org>
Wed, 20 Jan 2021 05:04:44 +0000 (14:04 +0900)
committerEric Wong <e@80x24.org>
Thu, 21 Jan 2021 03:29:17 +0000 (03:29 +0000)
waitpid() in DESTROY ends up setting $? for the exit status,
thus we must reap IPC children before calling CORE::exit.

This fixes t/lei-oneshot.t with TEST_RUN_MODE=0

lib/PublicInbox/LEI.pm

index f3edfe82fc3308b6844ed567cd253e37f6b91f68..97ae2c416cffb89aa31f5b8bea3e314811164d21 100644 (file)
@@ -249,6 +249,11 @@ sub x_it ($$) {
        if (my $sock = $self->{sock}) {
                send($sock, "x_it $code", MSG_EOR);
        } elsif (!($code & 127)) { # oneshot, ignore signals
+               # don't want to end up using $? from child processes
+               for my $f (qw(lxs l2m)) {
+                       my $wq = delete $self->{$f} or next;
+                       $wq->DESTROY;
+               }
                $quit->($code >> 8);
        }
 }