fix(sdk): handle Windows opencode spawn and shutdown (#20772)

This commit is contained in:
Luke Parker
2026-04-03 13:18:50 +10:00
committed by GitHub
parent e89527c9f0
commit 7b8dc8065e
8 changed files with 103 additions and 35 deletions

View File

@@ -51,7 +51,7 @@
"@tsconfig/bun": "catalog:",
"@types/babel__core": "7.20.5",
"@types/bun": "catalog:",
"@types/cross-spawn": "6.0.6",
"@types/cross-spawn": "catalog:",
"@types/mime-types": "3.0.1",
"@types/npmcli__arborist": "6.3.3",
"@types/semver": "^7.5.8",
@@ -118,7 +118,7 @@
"bun-pty": "0.4.8",
"chokidar": "4.0.3",
"clipboardy": "4.0.0",
"cross-spawn": "^7.0.6",
"cross-spawn": "catalog:",
"decimal.js": "10.5.0",
"diff": "catalog:",
"drizzle-orm": "catalog:",

View File

@@ -144,7 +144,11 @@ export namespace Process {
throw new RunFailedError(cmd, out.code, out.stdout, out.stderr)
}
// Duplicated in `packages/sdk/js/src/process.ts` because the SDK cannot import
// `opencode` without creating a cycle. Keep both copies in sync.
export async function stop(proc: ChildProcess) {
if (proc.exitCode !== null || proc.signalCode !== null) return
if (process.platform !== "win32" || !proc.pid) {
proc.kill()
return