From 7418f60f8e08f229db809c793f6d5fd096057603 Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Tue, 20 Aug 2024 00:48:44 -0400 Subject: [PATCH] fix: Don't let process continue running if the main app thread panics --- process/signal_handler.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/process/signal_handler.rs b/process/signal_handler.rs index 17b0a6db..3ff86734 100644 --- a/process/signal_handler.rs +++ b/process/signal_handler.rs @@ -87,7 +87,16 @@ where signals.extend(TERM_SIGNALS); let mut signals = SignalsInfo::::new(signals).expect("Need signal info"); - thread::spawn(app_exec); + thread::spawn(|| { + let app = thread::spawn(app_exec); + + if matches!(app.join(), Ok(())) { + expect_exit::exit_unwind(0); + } else { + error!("App thread panic!"); + expect_exit::exit_unwind(1); + } + }); let mut has_terminal = true; for info in &mut signals {