NodeChildProcessSpawner.ts
NodeChildProcessSpawner.ts overview
Section titled “NodeChildProcessSpawner.ts overview”Shared Node.js implementation of the child process spawner service.
This module adapts node:child_process.spawn to the Effect
ChildProcessSpawner service. Provide layer to run ChildProcess
commands in Node-compatible runtimes: commands get scoped process handles
with stdin sinks, stdout and stderr streams, exit-code waiting,
interruption-time cleanup, process killing, and custom file-descriptor pipes.
The implementation sits below the command-building API. It validates and
resolves cwd through the Effect FileSystem and Path services,
translates Node errno failures to PlatformError, and uses scopes to
terminate referenced children when the owning effect is interrupted or
finalized. Pipelines are flattened by flattenCommand and spawned one
process at a time, wiring the selected source stream (stdout, stderr,
all, or fdN) to the destination stdin or fdN.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”layers
Section titled “layers”Layer that provides the NodeChildProcessSpawner implementation.
Signature
declare const layer: Layer.Layer<ChildProcessSpawner, never, Path.Path | FileSystem.FileSystem>Since v4.0.0
models
Section titled “models”FlattenedPipeline (interface)
Section titled “FlattenedPipeline (interface)”Result of flattening a pipeline of commands.
Signature
export interface FlattenedPipeline { readonly commands: Arr.NonEmptyReadonlyArray<ChildProcess.StandardCommand> readonly pipeOptions: ReadonlyArray<ChildProcess.PipeOptions>}Since v4.0.0
transforming
Section titled “transforming”flattenCommand
Section titled “flattenCommand”Flattens a Command into an array of StandardCommands along with pipe
options for each connection.
Signature
declare const flattenCommand: (command: ChildProcess.Command) => FlattenedPipelineSince v4.0.0