]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei: correct exit signal
authorEric Wong <e@80x24.org>
Sun, 1 Oct 2023 09:54:23 +0000 (09:54 +0000)
committerEric Wong <e@80x24.org>
Sun, 1 Oct 2023 22:41:45 +0000 (22:41 +0000)
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

index 48c5644b182eec0af91581e6d65d09849bed0fd2..1b14d5e12a518cd88bdc27ac301863f5ae528925 100644 (file)
@@ -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