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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(process): finish the Command::new coverage sweep (K14 Punkt 5)
purpleb923424985e3
diff --git a/src-tauri/src/commands/install_method.rs b/src-tauri/src/commands/install_method.rsindex 335a8a4a..721f583b 100644--- a/src-tauri/src/commands/install_method.rs+++ b/src-tauri/src/commands/install_method.rs@@ -29,7 +29,7 @@use std::ffi::OsStr;use std::path::{Path, PathBuf};-use std::process::{Command, Stdio};+use std::process::Stdio;use std::time::{Duration, Instant};/// How a copy of LU got onto the machine, as far as the machine can tell.@@ -241,11 +241,12 @@ pub fn on_path(name: &str) -> bool {/// A missing binary, a crash and a query that runs past the deadline are all/// "no" - the caller must not learn anything from a probe that did not finish.fn query_owner(program: &str, args: &[&OsStr]) -> bool {- let mut child = match Command::new(program)- .args(args)+ let mut cmd = crate::process_util::foreign_system_command(program);+ cmd.args(args).stdin(Stdio::null()).stdout(Stdio::null())- .stderr(Stdio::null())+ .stderr(Stdio::null());+ let mut child = match cmd.spawn(){Ok(c) => c,diff --git a/src-tauri/src/commands/mlx.rs b/src-tauri/src/commands/mlx.rsindex 353f1108..cfc8a2af 100644--- a/src-tauri/src/commands/mlx.rs+++ b/src-tauri/src/commands/mlx.rs@@ -213,7 +213,7 @@ fn install_mlx_steps(slot: &crate::install_state::InstallSlot) -> Result<(), Strif !venv_dir.exists() {slot.log(format!("creating venv at {}", venv_dir.display()));std::fs::create_dir_all(mlx_root()).map_err(|e| os_error::english(&e))?;- let out = Command::new(&python)+ let out = crate::python::python_command(&python).args(["-m", "venv", venv_dir.to_str().unwrap()]).output().map_err(|e| format!("venv create failed to spawn: {}", os_error::english(&e)))?;@@ -232,7 +232,7 @@ fn install_mlx_steps(slot: &crate::install_state::InstallSlot) -> Result<(), Strstd::fs::write(&server_path, SERVER_PY).map_err(|e| format!("write server.py: {}", os_error::english(&e)))?;slot.log("running pip install (this pulls torch + diffusers, ~3 GB)");- let out = Command::new(venv_pip())+ let out = crate::python::python_command(venv_pip()).args(["install", "--upgrade", "-r", req_path.to_str().unwrap()]).output().map_err(|e| format!("pip install spawn: {}", os_error::english(&e)))?;@@ -263,7 +263,7 @@ fn install_mlx_steps(slot: &crate::install_state::InstallSlot) -> Result<(), Strp = patterns,);let prefetch = prefetch.as_str();- let mut prefetch_cmd = Command::new(venv_python());+ let mut prefetch_cmd = crate::python::python_command(venv_python());prefetch_cmd.args(["-c", prefetch]).env("HF_HOME", mlx_root().join("cache"))@@ -298,7 +298,7 @@ fn locate_python_311() -> Option<PathBuf> {}fn python_version(python: &PathBuf) -> Option<String> {- let out = Command::new(python).arg("--version").output().ok()?;+ let out = crate::python::python_command(python).arg("--version").output().ok()?;let v = String::from_utf8_lossy(&out.stdout).trim().to_string();let v = if v.is_empty() {String::from_utf8_lossy(&out.stderr).trim().to_string()@@ -813,7 +813,7 @@ fn refetch_file(f = repair.path,v = revision,);- let mut cmd = Command::new(python);+ let mut cmd = crate::python::python_command(python);cmd.args(["-c", &script]).env("HF_HOME", &cache).env("HF_XET_CACHE", hf_xet_cache_dir());apply_hf_token(&mut cmd);crate::commands::video::run_streamed(slot, &mut cmd)@@ -976,7 +976,7 @@ pub fn mlx_image_install_model(state: &AppState, args: &Value) -> CmdResult {r = entry2.repo,p = patterns.iter().map(|p| format!("{p:?}")).collect::<Vec<_>>().join(","),);- let mut cmd = Command::new(&python);+ let mut cmd = crate::python::python_command(&python);cmd.args(["-c", &script]).env("HF_HOME", mlx_root().join("cache")).env("HF_XET_CACHE", hf_xet_cache_dir());@@ -1210,7 +1210,7 @@ pub fn mlx_start(_state: &AppState, _args: &Value) -> CmdResult {// The sidecar re-validates every file of a model against the hub when it// loads one, so it needs the token as much as the installer does.- let mut server_cmd = Command::new(venv_python());+ let mut server_cmd = crate::python::python_command(venv_python());server_cmd.arg(&server).env("LU_MLX_PORT", MLX_PORT.to_string())diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rsindex 583701a9..a09fe5ee 100644--- a/src-tauri/src/commands/remote.rs+++ b/src-tauri/src/commands/remote.rs@@ -3195,7 +3195,7 @@ pub async fn start_tunnel({let tgz = dir.join("cloudflared.tgz");std::fs::write(&tgz, &bytes).map_err(|e| format!("write tgz: {}", os_error::english(&e)))?;- let status = std::process::Command::new("tar")+ let status = crate::process_util::foreign_system_command("tar").arg("-xzf").arg(&tgz).arg("-C")@@ -3227,7 +3227,7 @@ pub async fn start_tunnel(// `spawn_piped` gives it its own process group on Unix (so `kill_tree`// reaches anything it starts) and suppresses the console window on// Windows, exactly like every other child this app spawns.- let mut cmd = std::process::Command::new(&cf_path);+ let mut cmd = crate::process_util::foreign_system_command(&cf_path);// 127.0.0.1 (not "localhost") avoids a ~2 s IPv6 (::1) connect detour on// some Windows boxes before cloudflared falls back to IPv4 (aldrich 2026-06).cmd.args(["tunnel", "--url", &format!("http://127.0.0.1:{}", port)]);diff --git a/src-tauri/src/commands/search.rs b/src-tauri/src/commands/search.rsindex 155d4d50..cfe0386d 100644--- a/src-tauri/src/commands/search.rs+++ b/src-tauri/src/commands/search.rs@@ -502,32 +502,21 @@ pub fn install_searxng(state: State<'_, AppState>) -> Result<serde_json::Value,// On Windows we add CREATE_NO_WINDOW so the docker CLI doesn't flash a// console window at the user when they install SearXNG from LU.std::thread::spawn(move || {- #[cfg(windows)]- const CREATE_NO_WINDOW: u32 = 0x08000000;-- let mut pull_cmd = std::process::Command::new("docker");+ let mut pull_cmd = crate::process_util::foreign_system_command("docker");pull_cmd.args(["pull", "searxng/searxng"]);- #[cfg(windows)]- {- use std::os::windows::process::CommandExt;- pull_cmd.creation_flags(CREATE_NO_WINDOW);- }+ crate::process_util::suppress_window(&mut pull_cmd);let pull = pull_cmd.output();match pull {Ok(output) if output.status.success() => {- let mut run_cmd = std::process::Command::new("docker");+ let mut run_cmd = crate::process_util::foreign_system_command("docker");run_cmd.args(["run", "-d", "--name", "searxng","-p", "8888:8080","-e", "INSTANCE_NAME=locally-uncensored","searxng/searxng",]);- #[cfg(windows)]- {- use std::os::windows::process::CommandExt;- run_cmd.creation_flags(CREATE_NO_WINDOW);- }+ crate::process_util::suppress_window(&mut run_cmd);let _ = run_cmd.output();println!("[SearXNG] Installed and running on port 8888");}diff --git a/src-tauri/src/os_paths.rs b/src-tauri/src/os_paths.rsindex 20a56e35..bac2b419 100644--- a/src-tauri/src/os_paths.rs+++ b/src-tauri/src/os_paths.rs@@ -226,7 +226,7 @@ fn verify_python_path(path: &str) -> bool {if path.is_empty() || path.to_lowercase().contains("windowsapps") {return false;}- let mut cmd = std::process::Command::new(path);+ let mut cmd = crate::python::python_command(path);cmd.arg("--version");crate::process_util::suppress_window(&mut cmd);cmd.output().map(|o| o.status.success()).unwrap_or(false)@@ -235,7 +235,7 @@ fn verify_python_path(path: &str) -> bool {/// `where python` on PATH, skipping the WindowsApps Store-stub alias.#[cfg(target_os = "windows")]fn python_via_where() -> Option<PathBuf> {- let mut cmd = std::process::Command::new("where");+ let mut cmd = crate::process_util::foreign_system_command("where");cmd.arg("python");crate::process_util::suppress_window(&mut cmd);let out = cmd.output().ok()?;@@ -258,7 +258,7 @@ fn python_via_where() -> Option<PathBuf> {/// python.exe (needed for venv creation / pip), not the launcher shim.#[cfg(target_os = "windows")]fn python_via_py_launcher() -> Option<PathBuf> {- let mut cmd = std::process::Command::new("py");+ let mut cmd = crate::python::python_command("py");cmd.args(["-3", "-c", "import sys; print(sys.executable)"]);crate::process_util::suppress_window(&mut cmd);let out = cmd.output().ok()?;diff --git a/src-tauri/src/python.rs b/src-tauri/src/python.rsindex a437694d..cb9e7b2b 100644--- a/src-tauri/src/python.rs+++ b/src-tauri/src/python.rs@@ -234,7 +234,7 @@ pub fn resolve_comfyui_venv_python(comfyui_dir: &Path) -> Option<String> {pub fn get_python_bin() -> String {for name in crate::os_paths::unix_python_candidates() {let Ok(path) = which::which(name) else { continue };- let mut cmd = Command::new(&path);+ let mut cmd = python_command(&path);cmd.arg("--version");match cmd.output() {Ok(output) if output.status.success() => {@@ -271,18 +271,18 @@ fn verify_python_path(path: &str) -> bool {if path.is_empty() || path.contains("WindowsApps") {return false;}- let mut cmd = Command::new(path);+ let mut cmd = python_command(path);cmd.arg("--version");- cmd.creation_flags(CREATE_NO_WINDOW);+ crate::process_util::suppress_window(&mut cmd);cmd.output().map(|o| o.status.success()).unwrap_or(false)}/// `where python` on PATH, skipping the WindowsApps Store-stub alias.#[cfg(target_os = "windows")]fn python_via_where() -> Option<String> {- let mut where_cmd = Command::new("where");+ let mut where_cmd = crate::process_util::foreign_system_command("where");where_cmd.arg("python");- where_cmd.creation_flags(CREATE_NO_WINDOW);+ crate::process_util::suppress_window(&mut where_cmd);let output = where_cmd.output().ok()?;if !output.status.success() {return None;@@ -305,9 +305,9 @@ fn python_via_where() -> Option<String> {/// for venv creation / pip), not the launcher shim.#[cfg(target_os = "windows")]fn python_via_py_launcher() -> Option<String> {- let mut cmd = Command::new("py");+ let mut cmd = python_command("py");cmd.args(["-3", "-c", "import sys; print(sys.executable)"]);- cmd.creation_flags(CREATE_NO_WINDOW);+ crate::process_util::suppress_window(&mut cmd);let output = cmd.output().ok()?;if !output.status.success() {return None;@@ -472,9 +472,9 @@ pub fn python_interpreters() -> Vec<String> {found.push(p);}};- let mut launcher = Command::new("py");+ let mut launcher = python_command("py");launcher.arg("-0p");- launcher.creation_flags(CREATE_NO_WINDOW);+ crate::process_util::suppress_window(&mut launcher);if let Ok(out) = launcher.output() {if out.status.success() {for p in launcher_list_paths(&String::from_utf8_lossy(&out.stdout)) {@@ -482,9 +482,9 @@ pub fn python_interpreters() -> Vec<String> {}}}- let mut where_cmd = Command::new("where");+ let mut where_cmd = crate::process_util::foreign_system_command("where");where_cmd.arg("python");- where_cmd.creation_flags(CREATE_NO_WINDOW);+ crate::process_util::suppress_window(&mut where_cmd);if let Ok(out) = where_cmd.output() {if out.status.success() {for line in String::from_utf8_lossy(&out.stdout).lines() {