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-ASN: 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 482711F619 for ; Tue, 3 Mar 2020 09:50:57 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] spawn: correctly handle error code Date: Tue, 3 Mar 2020 09:50:57 +0000 Message-Id: <20200303095057.10918-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Both the C and pure Perl implementions of `pi_fork_exec' returns `-1' on error, not `undef'. --- lib/PublicInbox/Spawn.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 2d9f734c..ad6be187 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -210,7 +210,7 @@ sub spawn ($;$$) { } my $cd = $opts->{'-C'} // ''; # undef => NULL mapping doesn't work? my $pid = pi_fork_exec($redir, $f, $cmd, \@env, $rlim, $cd); - die "fork_exec failed: $!\n" unless defined $pid; + die "fork_exec failed: $!\n" unless $pid > 0; $pid; }