mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
Always die on panic.
This commit is contained in:
parent
ab952e3340
commit
cfa54cabbd
1 changed files with 12 additions and 0 deletions
12
src/main.rs
12
src/main.rs
|
@ -54,6 +54,18 @@ impl log::Log for Logger {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
// Rust does not die on panic by default. And -Cpanic=abort is broken.
|
||||
// https://github.com/rust-lang/cargo/issues/2738
|
||||
// Therefore this hack.
|
||||
std::panic::set_hook(Box::new(|panic_info| {
|
||||
if let Some(location) = panic_info.location() {
|
||||
println!("PANIC file '{}' line {}", location.file(), location.line());
|
||||
} else {
|
||||
println!("PANIC occurred but can't get location information...");
|
||||
}
|
||||
std::process::abort();
|
||||
}));
|
||||
|
||||
log::set_logger(&LOGGER).unwrap();
|
||||
let args = env::args().collect();
|
||||
let mut isolate = isolate::Isolate::new(args, ops::dispatch);
|
||||
|
|
Loading…
Add table
Reference in a new issue