mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
Atomic print and re-print desc on status, flush before reboot
Refactor print() to emit description + final status in a single call to cprintf(), preventing kernel messages from splitting the two parts. For two-phase print(-1,...) + print_result() sequences used by, e.g., run_interactive, save the last description and re-print it before the [ OK ] / [FAIL] output so the status is never left stranded on a blank line when command output or kernel messages have scrolled away the original description. Finally, add print_exit() which drains the console output buffer with tcdrain(2) and resets ANSI SGR attributes + cursor visibility before the kernel takes back the console on reboot/halt, preventing escape code leakage into bootloader or early-kernel output. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+66
-6
No files matched your search
@@ -424,14 +424,17 @@ void do_shutdown(shutop_t op)
|
||||
}
|
||||
|
||||
print(0, "Rebooting ...");
|
||||
print_exit();
|
||||
reboot(RB_AUTOBOOT);
|
||||
} else if (op == SHUT_OFF) {
|
||||
print(0, "Powering down ...");
|
||||
print_exit();
|
||||
reboot(RB_POWER_OFF);
|
||||
}
|
||||
|
||||
/* Also fallback if any of the other two fails */
|
||||
print(0, "Halting ...");
|
||||
print_exit();
|
||||
reboot(RB_HALT_SYSTEM);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user