1
2
3
4
5
6
7
8
9
10
11
12
13
use std::{panic, process};

/// Configures the panic hook to exit the program on every panic
pub fn configure_panic() {
    let default_hook = panic::take_hook();
    panic::set_hook(Box::new(move |panic_info| {
        // Invoke the default hook and exit the process
        default_hook(panic_info);
        println!("Exiting...");
        // TODO: setup a wait time and fold the log system properly
        process::exit(1);
    }));
}