pretty-print: enable stdio buffering while outputting progress bar
authorLennart Poettering <lennart@poettering.net>
Fri, 24 May 2024 09:56:13 +0000 (11:56 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 15 Jun 2024 00:18:10 +0000 (01:18 +0100)
commitaab74e1d93141823e844ef2427b5dcc457873475
tree3886cd7cc403dd7404dad342fadab703438893bd
parentbba55185de5ec142cbe8f65ec95287d05c51ab76
pretty-print: enable stdio buffering while outputting progress bar

Writing the progress bar so far was irritatingly slow, which was caused
by the fact that the various things we output so far resulted in one
write() syscall each because STDERR is unbuffered by default.

Let's fix that, and temporarily turn on full buffering for stderr,
restoring the normal unbuffered output right after.

This makes progress bar print visibly more efficient (and flicker free
too, since terminals no longer will move the cursor around during
output).
src/shared/pretty-print.c