fix(windows): suppress console flash for netstat/taskkill spawns#1338
Conversation
Windows shows a brief console window whenever a child process is spawned without the CREATE_NO_WINDOW (0x08000000) creation flag. Three call sites were missing it: - `find_pid_on_port` (core_process.rs): spawns `netstat` on startup to locate any stale listener on the RPC port. - `kill_pid_term` / `kill_pid_force` (process_kill.rs): spawn `taskkill` to signal/force-kill that stale process. Added `CommandExt::creation_flags(CREATE_NO_WINDOW)` to all three Windows-only `std::process::Command` calls so the helper processes run silently in the background.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds Windows console window suppression to process management operations. The ChangesWindows Console Window Suppression
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
/tinyhumansai#1338 follow-up) On Windows, `CreateProcess` allocates a conhost for every child unless `CREATE_NO_WINDOW` (creation flag `0x0800_0000`) is set. The shell-side spawns were fixed in tinyhumansai#731 (core sidecar) and tinyhumansai#1338 (netstat/taskkill). The core-side spawns were not — so any frontend-polled RPC that fans out into a native command (e.g. `local_ai_device_profile` -> `nvidia-smi`) flashes a console window on every poll. On a fresh Windows install with no Ollama, the combined effect was a continuous terminal-flash storm before the auth screen had even rendered. Sites covered: - `local_ai/install.rs`: PowerShell wrapper that runs OllamaSetup.exe - `local_ai/service/ollama_admin.rs`: `ollama --version`, `ollama serve`, candidate probe in `command_works`, `taskkill /F /IM ollama.exe` - `local_ai/device.rs`: `nvidia-smi --query-gpu` — re-probed by `handle_local_ai_device_profile` on every poll - `doctor/core.rs`: PowerShell `Get-PSDrive` for disk space, and `<cmd> --version` for `git` / `curl` / etc. - `node_runtime/resolver.rs`: `<bin> --version` in `probe_subcommand_version` - `service/common.rs` helpers (`run_checked`, `run_capture`, `run_best_effort`, `run_check_silent`) — silences every Windows `schtasks` call at the helper boundary (covers `status`, `start`, `stop`, `install`, `uninstall`, `is_task_exists_windows`). Linux `systemctl` and macOS `launchctl` callers go through the same helpers; `no_window` is a `cfg(not(windows))` no-op for them. New helper `local_ai/process_util::apply_no_window` keeps the `cfg(windows)` + `creation_flags` detail out of call sites. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nsai#731/tinyhumansai#1338 follow-up) (tinyhumansai#1498) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
CREATE_NO_WINDOW(0x08000000) flag to all Windowsstd::process::Commandspawns in the Tauri shell that were missing it.#[cfg(windows)]blocks.Problem
On Windows,
std::process::Commandinherits or allocates a console for the child process unlessCREATE_NO_WINDOWis explicitly set in thePROCESS_CREATION_FLAGS. Three call sites were spawning visible console windows:find_pid_on_port(core_process.rs) — runsnetstat -anoon everyensure_runningcall to detect a stale listener on the RPC port.kill_pid_term(process_kill.rs) — runstaskkill /PIDas a graceful-shutdown best-effort.kill_pid_force(process_kill.rs) — runstaskkill /F /T /PIDfor the force-kill follow-up.Because
ensure_runningis invoked periodically from the frontend (and during bootstrap/restart flows), users could see a console window flash every few seconds.Solution
Use
std::os::windows::process::CommandExt::creation_flags(0x0800_0000)(stdlib — no new deps) on each of the three WindowsCommandinstances. The constant is defined locally at the call site to avoid pulling in a winapi/windows crate.Submission Checklist
PROCESS_CREATION_FLAGSrequires a live Windows buildCREATE_NO_WINDOWflag on a process spawn helperImpact
#[cfg(windows)]).Related
CREATE_NO_WINDOWto thetaskkillcall inollama_admin.rsandnvidia-smiindevice.rsin a follow-up.AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
Validation Run
pnpm --filter openhuman-app format:check— passedpnpm typecheck— N/A (no TS changes)cargo check --manifest-path app/src-tauri/Cargo.toml— passed, 0 errorsValidation Blocked
Behavior Changes
netstat,taskkill) no longer create a visible console window.Parity Contract
Duplicate / Superseded PR Handling
Summary by CodeRabbit
Release Notes