From 25aaea3d3180f6c76b47d5886d1199bacf4443bd Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 5 Aug 2026 13:38:59 -0400 Subject: [PATCH] refactor(core): remove unused shell tree killer (#40680) --- packages/core/src/shell/select.ts | 34 ------------------------------- 1 file changed, 34 deletions(-) diff --git a/packages/core/src/shell/select.ts b/packages/core/src/shell/select.ts index 39e4af1b87e..07b725e0387 100644 --- a/packages/core/src/shell/select.ts +++ b/packages/core/src/shell/select.ts @@ -1,15 +1,12 @@ export * as ShellSelect from "./select" import path from "path" -import { spawn, type ChildProcess } from "child_process" import { readFile } from "fs/promises" import { statSync } from "fs" -import { setTimeout } from "node:timers/promises" import { Schema } from "effect" import { FSUtil } from "@opencode-ai/util/fs-util" import { which } from "../util/which" -const SIGKILL_TIMEOUT_MS = 200 const META: Record = { bash: { login: true, posix: true }, dash: { login: true, posix: true }, @@ -33,37 +30,6 @@ export const Options = Schema.Struct({ }) export type Options = typeof Options.Type -export async function killTree(proc: ChildProcess, opts?: { exited?: () => boolean }): Promise { - const pid = proc.pid - if (!pid || opts?.exited?.()) return - - if (process.platform === "win32") { - await new Promise((resolve) => { - const killer = spawn("taskkill", ["/pid", String(pid), "/f", "/t"], { - stdio: "ignore", - windowsHide: true, - }) - killer.once("exit", () => resolve()) - killer.once("error", () => resolve()) - }) - return - } - - try { - process.kill(-pid, "SIGTERM") - await setTimeout(SIGKILL_TIMEOUT_MS) - if (!opts?.exited?.()) { - process.kill(-pid, "SIGKILL") - } - } catch { - proc.kill("SIGTERM") - await setTimeout(SIGKILL_TIMEOUT_MS) - if (!opts?.exited?.()) { - proc.kill("SIGKILL") - } - } -} - function stat(file: string) { return statSync(file, { throwIfNoEntry: false }) ?? undefined }