Skip to content

Commit

Permalink
fix: set RUST_BACKTRACE outside of the panic hook
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Oct 20, 2024
1 parent 0514504 commit 220129a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/interface/src/panic_hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<FatalAbort>() {
std::process::exit(1);
Expand All @@ -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.
Expand Down

0 comments on commit 220129a

Please sign in to comment.