diff options
author | Eric Wong <e@80x24.org> | 2021-01-01 19:13:41 -1400 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-01-02 22:38:52 +0000 |
commit | 52f66173a50fd361b5f6eded9a40f09247243f7a (patch) | |
tree | 24ed5ba9204fb93be4535f05f26204f9c6e2d268 /lib/PublicInbox/Git.pm | |
parent | 93ae22374321c3f949102052f190c44fd45333b4 (diff) | |
download | public-inbox-52f66173a50fd361b5f6eded9a40f09247243f7a.tar.gz |
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.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r-- | lib/PublicInbox/Git.pm | 13 |
1 files changed, 11 insertions, 2 deletions
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 |