Hi Eric
On 17/06/2024 11:43, Eric Wong wrote:
+# ensure --batch-check is unbuffered by default
+my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-check));
+print $out $file1hash, "\n" or die $!;
It's been a while since I did any perl scripting and I'm not clear
whether $out is buffered or not and if it is whether it is guaranteed to
be flushed when we print "\n". It might be worth adding a explicit flush
so it is clear that any deadlocks come from cat-file and not our test code.
+my $info = <$in>;
Is there an easy way to add a timeout to this read so that the failure
mode isn't "the test hangs without printing anything"? I'm not sure that
failure mode is easy to diagnose from our CI output as it is hard to
tell which test caused the CI to timeout and it takes ages for the CI to
time out.
Best Wishes
Phillip
+is $info, "$file1hash blob 15\n", 'command_bidi_pipe w/ --batch-check';
+$r->command_close_bidi_pipe($pid, $in, $out, $ctx);
+
+# ditto with `info' with --batch-command
+($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-command));
+print $out 'info ', $file1hash, "\n" or die $!;
+$info = <$in>;
+is $info, "$file1hash blob 15\n", 'command_bidi_pipe w/ --batch-command=info';
+$r->command_close_bidi_pipe($pid, $in, $out, $ctx);
+
printf "1..%d\n", Test::More->builder->current_test;
my $is_passing = eval { Test::More->is_passing };