about summary refs log tree commit homepage
path: root/t
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 /t
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 't')
-rw-r--r--t/git_async.t4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/git_async.t b/t/git_async.t
index 4f7e4ebe..ffe2b1a2 100644
--- a/t/git_async.t
+++ b/t/git_async.t
@@ -117,6 +117,7 @@ my $dir = "$tmpdir/git.git";
         }
         my @info;
         my $str = '';
+        my $eof_seen = 0;
         $git->cat_async_compat('HEAD:foo.txt', sub {
                 my $ref = $_[0];
                 my $t = ref $ref;
@@ -124,10 +125,13 @@ my $dir = "$tmpdir/git.git";
                         push @info, $ref;
                 } elsif ($t eq 'SCALAR') {
                         $str .= $$ref;
+                } elsif ($ref == 0) {
+                        $eof_seen++;
                 } else {
                         fail "fail type: $t";
                 }
         });
+        is($eof_seen, 1, 'EOF seen once');
         is_deeply(\@info, [ [ 'bf4f17855632367a160bef055fc8ba4675d10e6b',
                                'blob', 18 ]], 'info matches compat');
         is($str, "-----\nhello\nworld\n", 'data matches compat');