mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
fix(vscode): strip Electron env vars in dev launch script (#8906)
* fix(vscode): strip Electron env vars in dev launch script When bun run extension is invoked from a VS Code task (e.g. the Agent Manager run button), ELECTRON_* and VSCODE_* env vars leak into the spawned process, causing VS Code to reuse the existing instance instead of opening a new window. Strip these vars before spawning. * fix(vscode): also strip Electron env vars in blocking launch path
This commit is contained in:
@@ -303,6 +303,13 @@ async function launch() {
|
||||
args.push("--wait")
|
||||
}
|
||||
|
||||
// Strip Electron/VS Code env vars so the spawned instance doesn't attach
|
||||
// to the current Electron process (e.g. when launched from a VS Code task).
|
||||
const env = { ...process.env }
|
||||
for (const key of Object.keys(env)) {
|
||||
if (key.startsWith("ELECTRON_") || key.startsWith("VSCODE_")) delete env[key]
|
||||
}
|
||||
|
||||
console.log(`[launch] Starting VS Code (${mode} mode)`)
|
||||
console.log(`[launch] Executable: ${app}`)
|
||||
console.log(`[launch] Workspace: ${workspace}`)
|
||||
@@ -311,7 +318,7 @@ async function launch() {
|
||||
if (blocking) {
|
||||
const result = Bun.spawnSync([app, ...args], {
|
||||
cwd: workspace,
|
||||
env: process.env,
|
||||
env,
|
||||
stdio: ["ignore", "inherit", "inherit"],
|
||||
})
|
||||
console.log(`[launch] VS Code exited (code ${result.exitCode})`)
|
||||
@@ -321,7 +328,7 @@ async function launch() {
|
||||
const child = spawn(app, args, {
|
||||
cwd: workspace,
|
||||
detached: !win,
|
||||
env: process.env,
|
||||
env,
|
||||
stdio: "ignore",
|
||||
...(win ? { shell: true } : {}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user