Thread (1 message) 1 message, 1 author, 2025-01-16

Re: [PATCH v3 4/6] usage: add show_usage_and_exit_if_asked()

From: Junio C Hamano <hidden>
Date: 2025-01-16 22:26:46

Jeff King [off-list ref] writes:
You said "may become a bit tricky" above, but unless I'm missing
something, it's just:
I didn't mean "tricky to write".  I meant it would become tricky to
reason about while reading the resulting code why we flush only when
fh is stderr.
I think the flush _is_ about earlier stdio calls in the process; that's
what 116d1fa6c6 (vreportf(): avoid relying on stdio buffering,
2019-10-30) says.
But as vreportf() has always been about stderr, when that old commit
talks about "stdio", it is talking about stderr, isn't it?
I do think it's unlikely for the process to write to
stdout() before processing "-h", but it seems like we should do the
safer thing as a general principle, unless it ends up hard to do so.
We are going to exit immediately at the end of this function, so
there is no point in avoiding an fflush() call that may not be
needed.  So I am not fundamentally opposed to unconditionally
flushing before doing the write().

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help