diff --git a/src/main.rs b/src/main.rs index 1d4c5cb..6e14a04 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,6 +36,13 @@ async fn main() -> Result<(), Box> { // install global collector configured based on RUST_LOG env var. tracing_subscriber::fmt::init(); + // cause process exit on panic in thread for restart container + let orig_hook = std::panic::take_hook(); + std::panic::set_hook(Box::new(move |panic_info| { + orig_hook(panic_info); + std::process::exit(1); + })); + let opt = Opt::from_args(); info!("start app");