Minor refactoring in panic handler

I don't think I really get why this newline is here. It moves the cursor
from the end of the newline to the beginning of the next line.  Maybe it
was added only for panics in background threads?  Either way it's fine.
This commit is contained in:
Johannes Altmanninger 2024-10-12 09:53:29 +02:00
parent 97581ed20f
commit 468849dd54

View File

@ -14,12 +14,10 @@ pub fn panic_handler(main: impl FnOnce() -> i32 + UnwindSafe) -> ! {
set_hook(Box::new(move |panic_info| {
standard_hook(panic_info);
eprintf!(
"%s crashed, please report a bug. Debug PID %d or press Enter to exit",
"%s crashed, please report a bug. Debug PID %d or press Enter to exit\n",
PROGRAM_NAME.get().unwrap(),
unsafe { libc::getpid() }
);
// Move the cursor down so it isn't blocking the text
eprintf!("\n");
let mut buf = [0_u8; 1];
loop {
let n = read_blocked(STDIN_FILENO, &mut buf).unwrap_or(0);