From a216b3cf6aee191907bcf42e83596e6fd7d016dd Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 2 Apr 2024 07:33:59 +0200 Subject: [PATCH] Print panic message to stderr, like the stack trace --- src/panic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panic.rs b/src/panic.rs index cce70ca39..be64c9d5d 100644 --- a/src/panic.rs +++ b/src/panic.rs @@ -13,7 +13,7 @@ pub fn panic_handler(main: impl FnOnce() -> i32 + UnwindSafe) -> ! { let standard_hook = take_hook(); set_hook(Box::new(move |panic_info| { standard_hook(panic_info); - printf!( + eprintf!( "%s crashed, please report a bug. Debug PID %d or press Enter to exit", PROGRAM_NAME.get().unwrap(), unsafe { libc::getpid() } @@ -24,7 +24,7 @@ pub fn panic_handler(main: impl FnOnce() -> i32 + UnwindSafe) -> ! { break; }; if n == 0 || matches!(buf[0], b'q' | b'\n' | b'\r') { - printf!("\n"); + eprintf!("\n"); break; } }