1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

watch: Use stdout rather than stderr to display output

Previously, the header was printed to stderr.

This matches the behavior of watch on Linux.
This commit is contained in:
Tim Ledbetter 2023-08-03 23:13:37 +01:00 committed by Andreas Kling
parent 2f3c41e033
commit ba1c4bc1d1

View file

@ -132,19 +132,19 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto watch_callback = [&] {
// Clear the screen, then reset the cursor position to the top left.
warn("\033[H\033[2J");
out("\033[H\033[2J");
// Print the header.
if (!flag_noheader) {
warnln("{}", header);
warnln();
outln("{}", header);
outln();
} else {
fflush(stderr);
fflush(stdout);
}
if (run_command(command) != 0) {
exit_code = 1;
if (flag_beep_on_fail) {
warnln("\a");
fflush(stderr);
out("\a");
fflush(stdout);
}
}
};