MCPcopy Create free account
hub / github.com/Effect-TS/effect / spawn

Function spawn

packages/platform/deno/src/DenoChildProcessSpawner.ts:171–188  ·  view source on GitHub ↗
(
    command: ChildProcess.StandardCommand,
    executable: string,
    args: ReadonlyArray<string>,
    options: Deno.CommandOptions
  )

Source from the content-addressed store, hash-verified

169 }
170
171 const spawn = (
172 command: ChildProcess.StandardCommand,
173 executable: string,
174 args: ReadonlyArray<string>,
175 options: Deno.CommandOptions
176 ) =>
177 Effect.try({
178 try: () => {
179 const childProcess = new Deno.Command(executable, { ...options, args: [...args] }).spawn()
180 const exitSignal = Deferred.makeUnsafe<Deno.CommandStatus, PlatformError.PlatformError>()
181 childProcess.status.then(
182 (status) => Deferred.doneUnsafe(exitSignal, Exit.succeed(status)),
183 (cause) => Deferred.doneUnsafe(exitSignal, Exit.fail(toPlatformError("status", cause, command)))
184 )
185 return [childProcess, exitSignal] as const
186 },
187 catch: (cause) => toPlatformError("spawn", cause, command)
188 })
189
190 const killProcess = (
191 command: ChildProcess.StandardCommand,

Callers 3

assertOpenResultFunction · 0.50

Calls 3

toPlatformErrorFunction · 0.70
succeedMethod · 0.45
failMethod · 0.45

Tested by 1

assertOpenResultFunction · 0.40