kona_cli/backtrace.rs
1//! Helper to set the backtrace env var.
2
3/// Sets the RUST_BACKTRACE environment variable to 1 if it is not already set.
4pub fn enable() {
5 // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
6 if std::env::var_os("RUST_BACKTRACE").is_none() {
7 // We accept the risk that another process may set RUST_BACKTRACE at the same time.
8 unsafe { std::env::set_var("RUST_BACKTRACE", "1") };
9 }
10}