From 220129ab225c34919ccaebc72d861cdae8b7777f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sun, 20 Oct 2024 20:33:36 +0200 Subject: [PATCH] fix: set RUST_BACKTRACE outside of the panic hook --- crates/interface/src/panic_hook.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/interface/src/panic_hook.rs b/crates/interface/src/panic_hook.rs index 26ca0f9d..8fd95861 100644 --- a/crates/interface/src/panic_hook.rs +++ b/crates/interface/src/panic_hook.rs @@ -8,6 +8,10 @@ const BUG_REPORT_URL: &str = /// Install the compiler's default panic hook. pub fn install() { + if std::env::var_os("RUST_BACKTRACE").is_none() { + std::env::set_var("RUST_BACKTRACE", "1"); + } + update_hook(|default_hook, info| { if info.payload().is::() { std::process::exit(1); @@ -16,10 +20,6 @@ pub fn install() { // Lock stderr to prevent interleaving of concurrent panics. let _guard = std::io::stderr().lock(); - if std::env::var_os("RUST_BACKTRACE").is_none() { - std::env::set_var("RUST_BACKTRACE", "1"); - } - default_hook(info); // Separate the output with an empty line.