On Thu, Apr 25, 2024 at 4:23 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes: > > That's very reminiscent of [1]. Although, unlike [1], the output > > presented to the user in this case is (I suppose) less likely to be > > messed up; only the combined captured output is probably affected. So, > > capturing stdout and stderr separately would indeed be a good idea. > > Between adding fflush() before err() writes, and updating err() to > write to the standard output stream, I am in favor of the latter for > its simplicity (of the mental model of the resulting code, not of > the patch that is required to do so). Writing to a common stream (stdout, in this case) for this sort of interactive session is indeed probably the way to go, as Phillip suggested. That was also the adopted solution to the cited similar example[1]; git-worktree was changed to send all its chatty output to stderr[2], which was appropriate for that (non-interactive) case. [1]: https://lore.kernel.org/git/CAPig+cTGq-10ZTBts2LXRVdPMf2vNMX8HTuhg_+ZHSiLX-brOQ@xxxxxxxxxxxxxx/ [2]: https://lore.kernel.org/git/20211203034420.47447-2-sunshine@xxxxxxxxxxxxxx/