mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-29 20:30:00 +08:00
The previous implementation passed CREATE_NEW_CONSOLE to a Rust StdCommand spawning cmd.exe directly, but Rust's default Stdio::inherit copies the parent stdio handles into STARTUPINFO with STARTF_USESTDHANDLES, which neutralizes CREATE_NEW_CONSOLE. The cmd process then ran without a visible window (MainWindowHandle = 0), so users only saw the OpenClaw node child started by runner.cmd in Task Manager and got the impression that "the terminal does not pop up". Wrap the launch in `cmd /c start "OpenClaw Gateway" /D <dir> cmd /D /K runner.cmd` so the new console is created by the `start` builtin via a fresh CreateProcess call without inherited stdio. The outer cmd /c itself is short-lived and uses CREATE_NO_WINDOW so it does not flash a window, and the inner cmd hosting runner.cmd reliably becomes a normal visible terminal that the user can close to stop Gateway. Because the visible terminal is now detached from our process tree, spawn().id() can no longer be tracked. Instead, poll netstat after the launch and record the listener PID as the active Gateway PID, which is what the stop path actually needs to send a precise kill to. ## Verification - cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check - cargo check --manifest-path src-tauri/Cargo.toml