From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E67701F56A for ; Sun, 1 Oct 2023 09:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1696154070; bh=uvKz62J5LGxCKP5/He6FiRCxzqvLCAkptASXy/tHnS4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=0VwDIWsB7j8Tf/4B0mZXwRc5mk0bVVet2ATJVm7mhAwmZGtR2HyRHvyAG59hXq6W7 0IEVc3dK/5I6CFpsfI2LieGaEU/eHIrPfc1mgTGlSD2fjzOtZQMr4nGP6bYnF9QZ5M HCaq7wr7Mn64sdYbSJM5zRTnvZO/38/AqjkmpzLM= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 07/13] lei: correct exit signal Date: Sun, 1 Oct 2023 09:54:23 +0000 Message-ID: <20231001095429.2092610-8-e@80x24.org> In-Reply-To: <20231001095429.2092610-1-e@80x24.org> References: <20231001095429.2092610-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: The first argument passed to Perl signal handlers is a signal name (e.g. "TERM") and not an integer that can be passed to the `exit' perlop. Thus we must look up the integer value from the POSIX module. --- lib/PublicInbox/LEI.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 48c5644b..1b14d5e1 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -1310,9 +1310,9 @@ sub lazy_start { local $quit = do { my (undef, $eof_p) = PublicInbox::PktOp->pair; sub { - $exit_code //= shift; + $exit_code //= eval("POSIX::SIG$_[0] + 128") if @_; eval 'PublicInbox::LeiNoteEvent::flush_task()'; - my $lis = $pil or exit($exit_code); + my $lis = $pil or exit($exit_code // 0); # closing eof_p triggers \&noop wakeup $listener = $eof_p = $pil = $path = undef; $lis->close; # DS::close