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: hide all Python console windows on Windows startup

PurpleDoubleDdab380220af1
diff --git a/src-tauri/src/commands/agent.rs b/src-tauri/src/commands/agent.rs
index 75260b54..5e415866 100644
--- a/src-tauri/src/commands/agent.rs
+++ b/src-tauri/src/commands/agent.rs
@@ -53,7 +53,8 @@ pub fn execute_code(
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
- // Piped stderr already hides console; CREATE_NO_WINDOW breaks Python stderr
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
let mut child = cmd.spawn()
.map_err(|e| format!("Spawn Python: {}", e))?;
diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rs
index e0c40039..80e728a2 100644
--- a/src-tauri/src/commands/process.rs
+++ b/src-tauri/src/commands/process.rs
@@ -415,7 +415,8 @@ pub fn auto_start_comfyui(state: &AppState) {
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
- // Note: DO NOT use CREATE_NO_WINDOW for ComfyUI — tqdm needs a valid stderr handle.
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(CREATE_NO_WINDOW);
match cmd.spawn() {
Ok(mut child) => {
// Drain stdout/stderr in background threads to prevent buffer deadlock
diff --git a/src-tauri/src/python.rs b/src-tauri/src/python.rs
index fb1e7259..93632109 100644
--- a/src-tauri/src/python.rs
+++ b/src-tauri/src/python.rs
@@ -1,6 +1,12 @@
use std::path::Path;
use std::process::Command;
+#[cfg(target_os = "windows")]
+use std::os::windows::process::CommandExt;
+
+#[cfg(target_os = "windows")]
+const CREATE_NO_WINDOW: u32 = 0x08000000;
+
/// Resolve the real Python binary path, filtering out Windows Store alias.
pub fn get_python_bin() -> String {
if cfg!(not(target_os = "windows")) {
@@ -16,14 +22,22 @@ pub fn get_python_bin() -> String {
}
// Windows: use `where python` and filter out WindowsApps alias
- if let Ok(output) = Command::new("where").arg("python").output() {
+ let mut where_cmd = Command::new("where");
+ where_cmd.arg("python");
+ #[cfg(target_os = "windows")]
+ where_cmd.creation_flags(CREATE_NO_WINDOW);
+ if let Ok(output) = where_cmd.output() {
if output.status.success() {
let stdout = String::from_utf8_lossy(&output.stdout);
for line in stdout.lines() {
let path = line.trim();
if !path.is_empty() && !path.contains("WindowsApps") {
// Verify it actually runs
- if let Ok(check) = Command::new(path).arg("--version").output() {
+ let mut check_cmd = Command::new(path);
+ check_cmd.arg("--version");
+ #[cfg(target_os = "windows")]
+ check_cmd.creation_flags(CREATE_NO_WINDOW);
+ if let Ok(check) = check_cmd.output() {
if check.status.success() {
println!("[Python] Found via `where`: {}", path);
return path.to_string();