Skip to content

Commit

Permalink
Merge pull request #643 from tursodatabase/optional-panic-backtrace
Browse files Browse the repository at this point in the history
optional backtrace on panic
  • Loading branch information
MarinPostma authored Nov 17, 2023
2 parents 8b5d6ae + aeab0b7 commit d39b279
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libsql-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,15 @@ async fn main() -> Result<()> {
)
.init();

std::panic::set_hook(Box::new(tracing_panic::panic_hook));
std::panic::set_hook(Box::new(|p| {
tracing_panic::panic_hook(p);
if let Ok(v) = std::env::var("RUST_BACKTRACE") {
if !v.is_empty() {
let bt = std::backtrace::Backtrace::force_capture();
eprintln!("{bt}");
}
}
}));

let args = Cli::parse();

Expand Down

0 comments on commit d39b279

Please sign in to comment.