Skip to content

Commit

Permalink
fix: Don't let process continue running if the main app thread panics
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpinder committed Aug 20, 2024
1 parent 50ba091 commit 7418f60
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion process/signal_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7418f60

Please sign in to comment.