Flush output buffers proactively#201
Conversation
|
|
||
| def print_red(msg): | ||
| print("\033[91m%s\033[0m" % msg, file=sys.stderr) | ||
| sys.stderr.flush() |
There was a problem hiding this comment.
stderr is unbuffered and many applications leverage this property. No need for flush.
There was a problem hiding this comment.
Indeed, see also man 3 stderr:
The stream stderr is unbuffered.
TIL!
There was a problem hiding this comment.
Though note that it seems that @kees is modifying the buffering of stderr for our boot wrapper script in ClangBuiltLinux/boot-utils#49.
|
|
||
| def print_red(msg): | ||
| print("\033[91m%s\033[0m" % msg, file=sys.stderr) | ||
| sys.stderr.flush() |
There was a problem hiding this comment.
Indeed, see also man 3 stderr:
The stream stderr is unbuffered.
TIL!
|
What changes are desired here? It's not harmful to flush stderr. At best it fixes intermixed output, and at worst it is redundant. :) |
|
Sure, but at the least the branch needs to be rebased on main and force pushed before we can merge. |
In the CI logs, QEMU output shows up before the rest of check_log.py output. This is likely due to IO buffering, so explicitly flush buffers in the helper routines and before spawning QEMU. Signed-off-by: Kees Cook <keescook@google.com>
|
Okay, rebased. :) |
In the CI logs, QEMU output shows up before the rest of check_log.py
output. This is likely due to IO buffering, so explicitly flush buffers
in the helper routines and before spawning QEMU.
Signed-off-by: Kees Cook keescook@google.com