]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei: ->fail only allows integer exit codes
authorEric Wong <e@80x24.org>
Sun, 1 Oct 2023 09:54:28 +0000 (09:54 +0000)
committerEric Wong <e@80x24.org>
Sun, 1 Oct 2023 22:41:49 +0000 (22:41 +0000)
We can't use floating point numbers nor Inf/-Inf as exit codes;
but we can allow `-1' as shorthand for 255.

lib/PublicInbox/LEI.pm

index 1b14d5e12a518cd88bdc27ac301863f5ae528925..1899bf38ce6804eeaae860e0d0d17960333e1e81 100644 (file)
@@ -524,7 +524,7 @@ sub sigpipe_handler { # handles SIGPIPE from @WQ_KEYS workers
 
 sub fail ($;@) {
        my ($lei, @msg) = @_;
-       my $exit_code = looks_like_number($msg[0]) ? shift(@msg) : undef;
+       my $exit_code = ($msg[0]//'') =~ /\A-?[0-9]+\z/ ? shift(@msg) : undef;
        local $current_lei = $lei;
        $lei->{failed}++;
        if (@msg) {