summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index bec97ea60..f6c85ef83 100644
--- a/src/main.rs
+++ b/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);