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

Function exec

packages/opencode/test/snapshot/snapshot.test.ts:37–42  ·  view source on GitHub ↗
(cwd: string, command: string[])

Source from the content-addressed store, hash-verified

35})
36
37const exec = (cwd: string, command: string[]) =>
38 Effect.promise(async () => {
39 const proc = Bun.spawn(command, { cwd, stdout: "ignore", stderr: "pipe" })
40 const code = await proc.exited
41 if (code !== 0) throw new Error(`${command.join(" ")} failed: ${await new Response(proc.stderr).text()}`)
42 })
43
44const write = (file: string, content: string | Uint8Array) =>
45 FSUtil.Service.use((fs) => fs.writeWithDirs(file, content))

Callers 1

snapshot.test.tsFile · 0.70

Calls 2

spawnMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected