about summary refs log tree commit homepage
path: root/lib/PublicInbox/GitAsync.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-03-04 03:52:29 +0000
committerEric Wong <e@80x24.org>2017-03-04 03:52:29 +0000
commit8a3fc4a2f027b36f27225ceee5908c571c8f4f47 (patch)
tree5ab6f45dc41d3d25bf71bcdd5c9c3108a22a8fbd /lib/PublicInbox/GitAsync.pm
parentd78b17adabb1880857c67fda40be0c47fe9d1866 (diff)
downloadpublic-inbox-8a3fc4a2f027b36f27225ceee5908c571c8f4f47.tar.gz
We need to ensure we've fully-drained the pipe before
signalling EOF to the callback, since pipelining may
not be the best choice with detachable processes
in the future.
Diffstat (limited to 'lib/PublicInbox/GitAsync.pm')
-rw-r--r--lib/PublicInbox/GitAsync.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/GitAsync.pm b/lib/PublicInbox/GitAsync.pm
index 8369978c..24e0bf3b 100644
--- a/lib/PublicInbox/GitAsync.pm
+++ b/lib/PublicInbox/GitAsync.pm
@@ -65,7 +65,7 @@ take_job:
                 }
                 $cb->($info); # $info may 0 (EOF, or undef, $cb will see $!)
                 return $self->close unless $info;
-                if ($check || (scalar(@$info) != 3)) {
+                if ($check || $info->[1] eq 'missing') {
                         # do not monopolize the event loop if we're drained:
                         return if ${$self->{rbuf}} eq '';
                         goto take_job;
@@ -89,6 +89,7 @@ final_hunk:
                 my $lf = chop $$rbuf;
                 $lf eq "\n" or die "BUG: missing LF (got $lf)";
                 $cb->($rbuf);
+                $cb->(0);
 
                 return if $buf eq '';
                 goto take_job;