Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: ask before quitting on top of a running install (#7550)

Daniel Han4f0cbf0d8184
diff --git a/studio/src-tauri/src/install.rs b/studio/src-tauri/src/install.rs
index d7226bf9015..39d67dc4278 100644
--- a/studio/src-tauri/src/install.rs
+++ b/studio/src-tauri/src/install.rs
@@ -783,6 +783,14 @@ pub fn record_install_intentional_stop(state: &InstallState, diagnostics: &Diagn
}
}
+/// True while an installer runs; quitting now would leave a broken venv.
+pub fn is_install_running(state: &InstallState) -> bool {
+ state
+ .lock()
+ .map(|install| install.child.is_some())
+ .unwrap_or(false)
+}
+
/// Stop a running install process gracefully.
/// Unix: SIGTERM to process group -> wait up to 5s -> SIGKILL
/// Windows: hidden taskkill /T /F to terminate the installer tree
diff --git a/studio/src-tauri/src/main.rs b/studio/src-tauri/src/main.rs
index a867700035a..0d39217ecdc 100644
--- a/studio/src-tauri/src/main.rs
+++ b/studio/src-tauri/src/main.rs
@@ -85,6 +85,33 @@ fn setup_custom_titlebar(app: &tauri::App) -> Result<(), Box<dyn std::error::Err
Ok(())
}
+/// Ask before quitting mid-install (true to proceed): `cleanup_child_processes` SIGTERMs the
+/// installer, leaving a venv that looks healthy but cannot start. Tray Quit only, since
+/// RunEvent::Exit must never block on a dialog nobody can answer.
+fn confirm_quit_during_install(app: &tauri::AppHandle) -> bool {
+ use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};
+
+ let Some(install_state) = app.try_state::<install::InstallState>() else {
+ return true;
+ };
+ if !install::is_install_running(&install_state) {
+ return true;
+ }
+ app.dialog()
+ .message(
+ "Unsloth Studio is still installing. Quitting now stops it part-way and \
+ leaves the installation incomplete, so it will need to be repaired before \
+ it can start.",
+ )
+ .kind(MessageDialogKind::Warning)
+ .title("Installation in progress")
+ .buttons(MessageDialogButtons::OkCancelCustom(
+ "Quit anyway".to_string(),
+ "Keep installing".to_string(),
+ ))
+ .blocking_show()
+}
+
fn cleanup_child_processes(app: &tauri::AppHandle) {
let diagnostics_state = app
.try_state::<diagnostics::DiagnosticsState>()
@@ -138,6 +165,9 @@ fn setup_tray(app: &tauri::App) -> Result<(), Box<dyn std::error::Error>> {
// leaving the backend orphaned.
let app_handle = app.clone();
std::thread::spawn(move || {
+ if !confirm_quit_during_install(&app_handle) {
+ return;
+ }
cleanup_child_processes(&app_handle);
app_handle.exit(0);
});