mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Revert "fix(cli): prevent zombie kilo serve processes on extension host crash"
This commit is contained in:
@@ -81,10 +81,7 @@ export class ServerManager {
|
||||
KILO_APP_VERSION: this.context.extension.packageJSON.version,
|
||||
KILO_VSCODE_VERSION: vscode.version,
|
||||
},
|
||||
// stdin is kept open as a keepalive pipe. The CLI watches for EOF on
|
||||
// stdin and shuts itself down. This ensures the server exits even when
|
||||
// the extension host is hard-killed and dispose() is never called.
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
detached: true,
|
||||
})
|
||||
console.log("[Kilo New] ServerManager: 📦 Process spawned with PID:", serverProcess.pid)
|
||||
@@ -184,9 +181,7 @@ export class ServerManager {
|
||||
const proc = this.instance.process
|
||||
this.instance = null
|
||||
|
||||
console.log("[Kilo New] ServerManager: 🔴 Disposing — closing stdin pipe, PID:", proc.pid)
|
||||
// Closing stdin signals the CLI to shut down gracefully via its EOF watcher.
|
||||
proc.stdin?.end()
|
||||
console.log("[Kilo New] ServerManager: 🔴 Disposing — sending SIGTERM to process group, PID:", proc.pid)
|
||||
ServerManager.killProcess(proc, "SIGTERM")
|
||||
|
||||
// SIGKILL fallback after 5s: mirrors the desktop app going straight to
|
||||
|
||||
@@ -39,18 +39,6 @@ export const ServeCommand = cmd({
|
||||
process.on("SIGTERM", shutdown)
|
||||
process.on("SIGINT", shutdown)
|
||||
process.on("SIGHUP", shutdown)
|
||||
|
||||
// When spawned by the VS Code extension, stdin is kept open as a keepalive
|
||||
// pipe. If the extension host is hard-killed (crash, OOM) the write-end of
|
||||
// the pipe is closed by the OS, causing an EOF here. We detect that and
|
||||
// trigger a clean shutdown so no zombie process is left behind.
|
||||
if (process.env["KILO_CLIENT"] === "vscode") {
|
||||
process.stdin.resume()
|
||||
process.stdin.on("end", () => {
|
||||
shutdown().catch(() => {})
|
||||
})
|
||||
}
|
||||
|
||||
await new Promise((resolve) => abort.signal.addEventListener("abort", resolve))
|
||||
// kilocode_change end
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user