(
command: ChildProcess.StandardCommand,
proc: NodeChildProcess.ChildProcess,
out: ChildProcess.StdoutConfig,
err: ChildProcess.StderrConfig,
)
| 240 | }) |
| 241 | |
| 242 | const setupOutput = ( |
| 243 | command: ChildProcess.StandardCommand, |
| 244 | proc: NodeChildProcess.ChildProcess, |
| 245 | out: ChildProcess.StdoutConfig, |
| 246 | err: ChildProcess.StderrConfig, |
| 247 | ) => { |
| 248 | let stdout = proc.stdout |
| 249 | ? NodeStream.fromReadable({ |
| 250 | evaluate: () => proc.stdout!, |
| 251 | onError: (cause) => toPlatformError("fromReadable(stdout)", toError(cause), command), |
| 252 | }) |
| 253 | : Stream.empty |
| 254 | let stderr = proc.stderr |
| 255 | ? NodeStream.fromReadable({ |
| 256 | evaluate: () => proc.stderr!, |
| 257 | onError: (cause) => toPlatformError("fromReadable(stderr)", toError(cause), command), |
| 258 | }) |
| 259 | : Stream.empty |
| 260 | |
| 261 | if (Sink.isSink(out.stream)) stdout = Stream.transduce(stdout, out.stream) |
| 262 | if (Sink.isSink(err.stream)) stderr = Stream.transduce(stderr, err.stream) |
| 263 | |
| 264 | return { stdout, stderr, all: Stream.merge(stdout, stderr) } |
| 265 | } |
| 266 | |
| 267 | const spawn = (command: ChildProcess.StandardCommand, opts: NodeChildProcess.SpawnOptions) => |
| 268 | Effect.callback<readonly [NodeChildProcess.ChildProcess, ExitSignal], PlatformError.PlatformError>((resume) => { |
no test coverage detected