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

Function spawn

packages/opencode/src/lsp/launch.ts:8–21  ·  view source on GitHub ↗
(cmd: string, argsOrOpts?: string[] | Process.Options, opts?: Process.Options)

Source from the content-addressed store, hash-verified

6export function spawn(cmd: string, args: string[], opts?: Process.Options): Child
7export function spawn(cmd: string, opts?: Process.Options): Child
8export function spawn(cmd: string, argsOrOpts?: string[] | Process.Options, opts?: Process.Options) {
9 const args = Array.isArray(argsOrOpts) ? [...argsOrOpts] : []
10 const cfg = Array.isArray(argsOrOpts) ? opts : argsOrOpts
11 const proc = Process.spawn([cmd, ...args], {
12 ...cfg,
13 stdin: "pipe",
14 stdout: "pipe",
15 stderr: "pipe",
16 }) as Child
17
18 if (!proc.stdin || !proc.stdout || !proc.stderr) throw new Error("Process output not available")
19
20 return proc
21}

Callers 5

launch.test.tsFile · 0.90
spawnFunction · 0.90
spawnFakeServerFunction · 0.50
runFunction · 0.50
db.tsFile · 0.50

Calls 1

spawnMethod · 0.80

Tested by 1

spawnFakeServerFunction · 0.40