Re: [PATCH v4 0/2] launch_editor(): indicate that Git waits for user input
- From
Jeff King <peff@peff.net>
- Date
- Nov 30, 2017, 20:12 UTC
- Message-ID
- <20171130201217.GA3578@sigill.intra.peff.net>
- In-Reply-To
- <20171129183514.wze5trxjfgqxqs7z@laptop.local>
On Wed, Nov 29, 2017 at 06:35:16PM +0000, Thomas Adam wrote:
Show 9 quoted lines
> On Wed, Nov 29, 2017 at 03:37:50PM +0100, lars.schneider@autodesk.com wrote:
> > + if (print_waiting_for_editor) {
> > + fprintf(stderr, _("hint: Waiting for your editor input..."));
> > fflush(stderr);
>
> Just FYI, stderr is typically unbuffered on most systems I've used, and
> although the call to fflush() is harmless, I suspect it's not having any
> effect. That said, there's plenty of other places in Git which seems to think
> fflush()ing stderr actually does something.I'd prefer to keep them (including this one), even if they are noops on most platforms, because:
1. They serve as a note for readers of the code that it's important
for the output to have been printed immediately. 2. We build on some funny and antique platforms. I wouldn't be
surprised if there's one that line buffers by default. Or even a
modern system with funny settings (e.g., using the GNU stdbuf
tool).(I know you said later you don't think this case needs to be removed, but I want to make it clear I think it's a reasonable project-wide policy to not assume we we know how stderr is buffered).
-Peff