From: Junio C Hamano Date: Tue, 07 Jan 2025 16:02:06 GMT Subject: Re: [PATCH 02/10] t7422: fix flaky test caused by buffered stdout Message-ID: In-Reply-To: <20250107024829.GC2363@coredump.intra.peff.net> Jeff King writes: > So I think a simpler and more robust version is just this: > > { > { yes || true; } && > command_expecting_sigpipe; echo $? >status > } | true > > We'll keep producing data in "yes" until the pipe is closed. So it will > closed before command_expecting_sigpipe even starts, and there is no > race there. And because we're using "true" on the right-hand side of the > pipe, nothing is read at all from the pipe. So there's no guessing about > how much might have been read. ;-) > Like I said, this won't help our current situation, but after having > spent a little time on it (before realizing that) I figured it was worth > documenting. It is always fun to ses these clever hacks on the list. Thanks.