diff options
author | Eric Wong <e@80x24.org> | 2017-03-04 03:52:29 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-03-04 03:52:29 +0000 |
commit | 8a3fc4a2f027b36f27225ceee5908c571c8f4f47 (patch) | |
tree | 5ab6f45dc41d3d25bf71bcdd5c9c3108a22a8fbd /lib/PublicInbox/Git.pm | |
parent | d78b17adabb1880857c67fda40be0c47fe9d1866 (diff) | |
download | public-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/Git.pm')
-rw-r--r-- | lib/PublicInbox/Git.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 6a7b109f..893df71e 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -253,10 +253,10 @@ sub cat_async_compat ($$$) { $self->{out}->print($obj."\n") or fail($self, "write error: $!"); my $in = $self->{in}; my $info = async_info_compat($in); + my (undef, $type, $left) = @$info; $cb->($info); - return if scalar(@$info) != 3; # missing + return if $info->[1] eq 'missing'; my $max = 8192; - my $left = $info->[2]; my ($buf, $r); while ($left > 0) { $r = read($in, $buf, $left > $max ? $max : $left); @@ -267,6 +267,7 @@ sub cat_async_compat ($$$) { $r = read($in, $buf, 1); defined($r) or fail($self, "read failed: $!"); fail($self, 'newline missing after blob') if ($r != 1 || $buf ne "\n"); + $cb->(0); } sub check_async { |