fix: Don't let process continue running if the main app thread panics

This commit is contained in:
Gerald Pinder 2024-08-20 00:48:44 -04:00
parent 50ba091ed0
commit 7418f60f8e

View file

@ -87,7 +87,16 @@ where
signals.extend(TERM_SIGNALS);
let mut signals = SignalsInfo::<WithOrigin>::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 {