From 468849dd543fb143926d63fdde7d7cedfd49dba0 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 12 Oct 2024 09:53:29 +0200 Subject: [PATCH] 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. --- src/panic.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/panic.rs b/src/panic.rs index 93c87d9cc..baa41b63c 100644 --- a/src/panic.rs +++ b/src/panic.rs @@ -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);