MCPcopy Index your code
hub / github.com/anomalyco/opencode / stop

Function stop

packages/opencode/src/util/process.ts:149–163  ·  view source on GitHub ↗
(proc: ChildProcess)

Source from the content-addressed store, hash-verified

147// Duplicated in `packages/sdk/js/src/process.ts` because the SDK cannot import
148// `opencode` without creating a cycle. Keep both copies in sync.
149export async function stop(proc: ChildProcess) {
150 if (proc.exitCode !== null || proc.signalCode !== null) return
151
152 if (process.platform !== "win32" || !proc.pid) {
153 proc.kill()
154 return
155 }
156
157 const out = await run(["taskkill", "/pid", String(proc.pid), "/T", "/F"], {
158 nothrow: true,
159 })
160
161 if (out.code === 0) return
162 proc.kill()
163}
164
165export async function text(cmd: string[], opts: RunOptions = {}): Promise<TextResult> {
166 const out = await run(cmd, opts)

Callers

nothing calls this directly

Calls 1

runFunction · 0.70

Tested by

no test coverage detected