From: Eric Wong Date: Sat, 2 Jan 2021 09:13:41 +0000 (-1400) Subject: git: qx: waitpid synchronously via ProcessPipe->CLOSE X-Git-Tag: v1.7.0~1424 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=52f66173a50fd361b5f6eded9a40f09247243f7a;p=public-inbox.git git: qx: waitpid synchronously via ProcessPipe->CLOSE If we're using ->qx, we're operating synchronously anyways, so there's little point in relying on the event loop for waitpid. --- diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index f7332bb6..cdd2b400 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -365,8 +365,17 @@ sub popen { sub qx { my $self = shift; my $fh = $self->popen(@_); - local $/ = wantarray ? "\n" : undef; - <$fh>; + if (wantarray) { + local $/ = "\n"; + my @ret = <$fh>; + close $fh; # caller should check $? + @ret; + } else { + local $/; + my $ret = <$fh>; + close $fh; # caller should check $? + $ret; + } } # check_async and cat_async may trigger the other, so ensure they're