MCPcopy Create free account
hub / github.com/anomalyco/opencode / stop

Function stop

packages/sdk/js/src/process.ts:5–12  ·  view source on GitHub ↗
(proc: ChildProcess)

Source from the content-addressed store, hash-verified

3// Duplicated from `packages/opencode/src/util/process.ts` because the SDK cannot
4// import `opencode` without creating a cycle (`opencode` depends on `@opencode-ai/sdk`).
5export function stop(proc: ChildProcess) {
6 if (proc.exitCode !== null || proc.signalCode !== null) return
7 if (process.platform === "win32" && proc.pid) {
8 const out = spawnSync("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true })
9 if (!out.error && out.status === 0) return
10 }
11 proc.kill()
12}
13
14export function bindAbort(proc: ChildProcess, signal?: AbortSignal, onAbort?: () => void) {
15 if (!signal) return () => {}

Callers 5

createOpencodeServerFunction · 0.90
closeFunction · 0.90
createOpencodeServerFunction · 0.90
closeFunction · 0.90
abortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected