Re: [PATCH 2/2] t9700: ensure cat-file info isn't buffered by default
On 19/06/2024 19:08, Eric Wong wrote:
Show 16 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> wrote:
>> 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.
>
> Pipes and sockets created by Perl are always unbuffered since
> 5.8, at least. If they were buffered, Git.pm users (including
> git-svn) wouldn't have worked at all.
Thanks for clarifying that
Show 8 quoted lines
>>> +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.
>
> Yeah, select() has been added in v2.
That's much nicer.
Thanks
Phillip