From: Eric Wong Date: Tue, 26 Sep 2023 07:44:36 +0000 (+0000) Subject: auto_reap: waitpid never returns undef X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=258412f81ca477c0f86101c3dfeeab0ec19d906c;p=thirdparty%2Fpublic-inbox.git auto_reap: waitpid never returns undef Reading the Perl source, it seems impossible to for waitpid to return undef. perlipc(1) man page also documents waitpid (and `wait') as functions which always restart on EINTR. --- diff --git a/lib/PublicInbox/AutoReap.pm b/lib/PublicInbox/AutoReap.pm index 23ecce772..ae4984b80 100644 --- a/lib/PublicInbox/AutoReap.pm +++ b/lib/PublicInbox/AutoReap.pm @@ -3,8 +3,7 @@ # automatically kill + reap children when this goes out-of-scope package PublicInbox::AutoReap; -use v5.10.1; -use strict; +use v5.12; sub new { my (undef, $pid, $cb) = @_; @@ -21,8 +20,8 @@ sub join { my $pid = delete $self->{pid} or return; $self->{cb}->() if defined $self->{cb}; CORE::kill($sig, $pid) if defined $sig; - my $ret = waitpid($pid, 0) // die "waitpid($pid): $!"; - $ret == $pid or die "BUG: waitpid($pid) != $ret"; + my $r = waitpid($pid, 0); + $r == $pid or die "BUG? waitpid($pid) => $r (\$?=$? \$!=$!)"; } sub DESTROY {