Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set RUST_BACKTRACE outside of the panic hook #80

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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