mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-10-29 18:52:45 +08:00
fix: add windowsHide:true to remaining spawn/exec calls to prevent CMD flash on Windows
Previous fixes in #6813 and subsequent PRs added windowsHide:true to most spawn sites, but several call sites were missed or regressed: - SDK server.ts (v1 + v2): kilo serve and TUI spawn - ts-check.ts: Bun.spawn for tsc invocation - github.ts: exec for browser open - desktop-electron cli.ts: install script spawn and version check - desktop-electron ipc.ts: open-path execFile - desktop-electron apps.ts: wsl/where execFileSync calls Without windowsHide:true, each of these subprocess invocations causes a visible cmd.exe console window to briefly flash on Windows. Closes #7896
This commit is contained in:
@@ -21,11 +21,11 @@ export function wslPath(path: string, mode: "windows" | "linux" | null): string
|
||||
if (path.startsWith("~")) {
|
||||
const suffix = path.slice(1)
|
||||
const cmd = `wslpath ${flag} \"$HOME${suffix.replace(/\"/g, '\\"')}\"`
|
||||
const output = execFileSync("wsl", ["-e", "sh", "-lc", cmd])
|
||||
const output = execFileSync("wsl", ["-e", "sh", "-lc", cmd], { windowsHide: true })
|
||||
return output.toString().trim()
|
||||
}
|
||||
|
||||
const output = execFileSync("wsl", ["-e", "wslpath", flag, path])
|
||||
const output = execFileSync("wsl", ["-e", "wslpath", flag, path], { windowsHide: true })
|
||||
return output.toString().trim()
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to run wslpath: ${String(error)}`)
|
||||
@@ -51,7 +51,7 @@ function checkMacosApp(appName: string) {
|
||||
function resolveWindowsAppPath(appName: string): string | null {
|
||||
let output: string
|
||||
try {
|
||||
output = execFileSync("where", [appName]).toString()
|
||||
output = execFileSync("where", [appName], { windowsHide: true }).toString()
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export async function installCli(): Promise<string> {
|
||||
writeFileSync(tempScript, script, "utf8")
|
||||
chmodSync(tempScript, 0o755)
|
||||
|
||||
const cmd = spawn(tempScript, ["--binary", sidecar], { stdio: "pipe" })
|
||||
const cmd = spawn(tempScript, ["--binary", sidecar], { stdio: "pipe", windowsHide: true })
|
||||
return await new Promise<string>((resolve, reject) => {
|
||||
cmd.on("exit", (code: number | null) => {
|
||||
try {
|
||||
@@ -107,7 +107,7 @@ export function syncCli() {
|
||||
|
||||
let version = ""
|
||||
try {
|
||||
version = execFileSync(installPath, ["--version"]).toString().trim()
|
||||
version = execFileSync(installPath, ["--version"], { windowsHide: true }).toString().trim()
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ export function registerIpcHandlers(deps: Deps) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const [cmd, args] =
|
||||
process.platform === "darwin" ? (["open", ["-a", app, path]] as const) : ([app, [path]] as const)
|
||||
execFile(cmd, args, (err) => (err ? reject(err) : resolve()))
|
||||
execFile(cmd, args, { windowsHide: true }, (err) => (err ? reject(err) : resolve()))
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ export const GithubInstallCommand = cmd({
|
||||
? `start "" "${url}"`
|
||||
: `xdg-open "${url}"`
|
||||
|
||||
exec(command, (error) => {
|
||||
exec(command, { windowsHide: true }, (error) => {
|
||||
if (error) {
|
||||
prompts.log.warn(`Could not open browser. Please visit: ${url}`)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ export namespace TsCheck {
|
||||
cwd: root,
|
||||
stdout: "pipe",
|
||||
stderr: "pipe",
|
||||
windowsHide: true,
|
||||
env: { ...process.env },
|
||||
})
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ export async function createKiloServer(options?: ServerOptions) {
|
||||
const proc = spawn(`kilo`, args, {
|
||||
// kilocode_change end
|
||||
signal: options.signal,
|
||||
windowsHide: true,
|
||||
env: {
|
||||
...process.env,
|
||||
KILO_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
|
||||
@@ -148,6 +149,7 @@ export function createKiloTui(options?: TuiOptions) {
|
||||
// kilocode_change end
|
||||
signal: options?.signal,
|
||||
stdio: "inherit",
|
||||
windowsHide: true,
|
||||
env: {
|
||||
...process.env,
|
||||
KILO_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
|
||||
|
||||
@@ -68,6 +68,7 @@ export async function createKiloServer(options?: ServerOptions) {
|
||||
const proc = spawn(`kilo`, args, {
|
||||
// kilocode_change end
|
||||
signal: options.signal,
|
||||
windowsHide: true,
|
||||
env: {
|
||||
...process.env,
|
||||
KILO_CONFIG_CONTENT: buildConfigEnv(options.config), // kilocode_change
|
||||
@@ -148,6 +149,7 @@ export function createKiloTui(options?: TuiOptions) {
|
||||
// kilocode_change end
|
||||
signal: options?.signal,
|
||||
stdio: "inherit",
|
||||
windowsHide: true,
|
||||
env: {
|
||||
...process.env,
|
||||
KILO_CONFIG_CONTENT: buildConfigEnv(options?.config), // kilocode_change
|
||||
|
||||
Reference in New Issue
Block a user