Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(install): ein abgebrochener Installationslauf sagt den Grund und den naechsten Schritt

purple292d02c88084
diff --git a/src-tauri/src/commands/video.rs b/src-tauri/src/commands/video.rs
index e324a0dc..9224aa98 100644
--- a/src-tauri/src/commands/video.rs
+++ b/src-tauri/src/commands/video.rs
@@ -817,15 +817,88 @@ pub(crate) fn run_streamed(slot: &crate::install_state::InstallSlot, cmd: &mut C
let _ = t1.join();
let _ = t2.join();
if !status.success() {
- return Err(format!("command exited {:?}", status.code()));
+ return Err(exit_reason(&status));
}
Ok(())
}
+/// Why a child did not run to the end, in a sentence a user can act on.
+///
+/// The old line was `format!("command exited {:?}", status.code())`, and after
+/// a cancelled MLX download the panel read "command exited None" (bauer-m on
+/// the Mac, 11.09.2026, N4). `None` is not an error code, it is the ABSENCE of
+/// one: a process that ends on a signal never gets an exit code. Somebody
+/// whose download died after hours was handed the least informative line the
+/// app can produce.
+///
+/// The second half of that finding, that a cancelled download starts from zero
+/// again, is not ours to fix here: huggingface_hub has named its partial file
+/// `blobs/<sha256>.<8 random hex>.incomplete` since 1.18, deliberately, so
+/// that two writers cannot poison one shared partial, and no later run can
+/// pick it up (see mlx_snapshot.rs, `Partial`). What this message can do is
+/// stop it from being a surprise.
+fn exit_reason(status: &std::process::ExitStatus) -> String {
+ if let Some(code) = status.code() {
+ return format!("The installer stopped with exit code {code}.");
+ }
+ let signal = {
+ #[cfg(unix)]
+ {
+ use std::os::unix::process::ExitStatusExt;
+ status.signal()
+ }
+ #[cfg(not(unix))]
+ {
+ None::<i32>
+ }
+ };
+ let how = match signal {
+ Some(sig) => format!("The installer was stopped before it finished (signal {sig})."),
+ None => "The installer ended before it finished, without an exit code.".to_string(),
+ };
+ format!("{how} Start it again: a partial download cannot be resumed, so it begins from the start.")
+}
+
#[cfg(test)]
mod tests {
use super::*;
+ /// "command exited None" war die Meldung nach einem abgebrochenen
+ /// MLX-Download (bauer-m N4). Siehe den Kopf von `exit_reason`.
+ // Der Rohstatus mit einem Signal darin gibt es nur unter Unix; auf Windows
+ // hat jeder beendete Prozess einen Code, dort kann "None" nicht entstehen.
+ #[cfg(unix)]
+ #[test]
+ fn a_killed_installer_says_what_happened_and_what_to_do() {
+ use std::os::unix::process::ExitStatusExt;
+ let killed = std::process::ExitStatus::from_raw(9); // SIGKILL, kein Exit-Code
+ assert_eq!(killed.code(), None, "die Ausgangslage des Befunds");
+ let msg = exit_reason(&killed);
+ assert!(!msg.contains("None"), "die alte Zeile ist zurueck: {msg}");
+ assert!(msg.contains("signal 9"), "{msg}");
+ assert!(msg.contains("Start it again"), "die Meldung nennt den naechsten Schritt nicht: {msg}");
+ assert!(msg.contains("begins from the start"), "{msg}");
+
+ // Gegenprobe: ein gewoehnlicher Fehlschlag nennt weiter seinen Code
+ // und erzaehlt nichts vom Fortsetzen.
+ let failed = std::process::ExitStatus::from_raw(1 << 8); // exit(1)
+ assert_eq!(failed.code(), Some(1));
+ let msg = exit_reason(&failed);
+ assert!(msg.contains("exit code 1"), "{msg}");
+ assert!(!msg.contains("Start it again"), "{msg}");
+
+ // Und der Satz erreicht die Oberflaeche wirklich: `run_streamed` ist
+ // der einzige Ort, der den Status eines Installationskindes in einen
+ // Fehler verwandelt, und er muss diesen hier nehmen.
+ let src = include_str!("video.rs");
+ // Nur der Rumpf von run_streamed, sonst faende sich der Aufruf in
+ // diesem Test selbst wieder und der Waechter bewiese nichts.
+ let body = &src[src.find("pub(crate) fn run_streamed").expect("run_streamed")
+ ..src.find("/// Why a child did not run to the end").expect("exit_reason")];
+ assert!(body.contains("Err(exit_reason(&status))"), "run_streamed meldet wieder selbst");
+ assert!(!body.contains("command exited"), "die alte Zeile steht wieder im Quelltext");
+ }
+
#[test]
fn catalog_ids_unique_and_covers_hardware_range() {
let mut ids: Vec<&str> = CATALOG.iter().map(|c| c.id).collect();