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

Function setupStdin

packages/core/src/cross-spawn-spawner.ts:223–240  ·  view source on GitHub ↗
(
    command: ChildProcess.StandardCommand,
    proc: NodeChildProcess.ChildProcess,
    cfg: ChildProcess.StdinConfig,
  )

Source from the content-addressed store, hash-verified

221 })
222
223 const setupStdin = (
224 command: ChildProcess.StandardCommand,
225 proc: NodeChildProcess.ChildProcess,
226 cfg: ChildProcess.StdinConfig,
227 ) =>
228 Effect.suspend(() => {
229 let sink: Sink.Sink<void, unknown, never, PlatformError.PlatformError> = Sink.drain
230 if (Predicate.isNotNull(proc.stdin)) {
231 sink = NodeSink.fromWritable({
232 evaluate: () => proc.stdin!,
233 onError: (err) => toPlatformError("fromWritable(stdin)", toError(err), command),
234 endOnDone: cfg.endOnDone,
235 encoding: cfg.encoding,
236 })
237 }
238 if (Stream.isStream(cfg.stream)) return Effect.as(Effect.forkScoped(Stream.run(cfg.stream, sink)), sink)
239 return Effect.succeed(sink)
240 })
241
242 const setupOutput = (
243 command: ChildProcess.StandardCommand,

Callers 1

Calls 4

toPlatformErrorFunction · 0.85
toErrorFunction · 0.85
asMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected