Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(desktop): use _exit for forced process termination

Richie McIlroy49edab63aaac
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index eccb7e195..1de5fd048 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -206,6 +206,13 @@ where
}
}
+fn force_exit(code: i32) -> ! {
+ unsafe extern "C" {
+ fn _exit(code: i32) -> !;
+ }
+ unsafe { _exit(code) }
+}
+
fn spawn_exit_watchdog() {
std::thread::spawn(move || {
std::thread::sleep(APP_EXIT_FORCE_TIMEOUT);
@@ -213,7 +220,7 @@ fn spawn_exit_watchdog() {
timeout_ms = APP_EXIT_FORCE_TIMEOUT.as_millis(),
"Forcing process exit after shutdown deadline"
);
- std::process::exit(0);
+ force_exit(0);
});
}
@@ -1202,7 +1209,7 @@ fn finalize_app_exit(app: &AppHandle, exit_code: i32) -> ! {
}
});
match app_exit_action(exit_code) {
- AppExitAction::Process(code) => std::process::exit(code),
+ AppExitAction::Process(code) => force_exit(code),
}
}