From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5C5971FA13 for ; Wed, 20 Jan 2021 05:04:50 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/7] lei: exit code in oneshot mode Date: Wed, 20 Jan 2021 14:04:44 +0900 Message-Id: <20210120050449.71330-3-e@80x24.org> In-Reply-To: <20210119093435.17955-1-e@80x24.org> References: <20210119093435.17955-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index f3edfe82..97ae2c41 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -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); } }