You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
process: pass existing file descriptors to a child, and expose its terminating signal #10842
Two capabilities that Node's child_process.spawn has and effect/processChildProcess (4.1.5) cannot express. They block migrating some real launchers to Effect.
1. Pass an existing parent file descriptor to the child
Node accepts an existing descriptor in stdio (spawn(cmd, args, { stdio: ["ignore", logFd, logFd, lockFd] })). Use cases we have:
A server writing directly into a log file. Tests read that file right after a request and rely on the server's own synchronous writes. A Sink on stdout/stderr streams through the parent, so lines land later than the request that produced them.
Inherited lock descriptors. A launcher passes open, already-acquired lock files to its child through extra descriptors. additionalFds always creates new pipes, so the child cannot inherit them.
A possible shape: stdout/stderr/additionalFds entries accepting an existing descriptor (for example a branded FileDescriptor, or a scoped FileSystem.File) that is passed through unchanged.
2. Expose how the child terminated
The handle exposes exitCode. A wrapper that mirrors its child's termination as 128 + signal (the shell convention) needs the terminating signal, which Node reports through 'exit''s (code, signal). A possible shape: an exit Effect yielding { code } | { signal }.
Related: #10841, which ensures detached: false children are only ever signalled by their own pid.
I'd like to implement the second half of this (how the child terminated), using the shape suggested above: handle.exit: Effect<{ code: ExitCode } | { signal: ChildProcess.Signal }, PlatformError>.
The Node and native Deno backends already record the exit code or signal, and Bun shares the Node backend. handle.exitCode would keep failing with PlatformError on signal termination, as it does and is tested today.
One choice needs a maintainer: a required exit member changes the handle contract for custom spawners and makeHandle callers. Would you take it as a required member, or prefer a shape that leaves ChildProcessHandle unchanged?
Tests would cover zero and nonzero exits, signals, repeated observers, pipelines (last command's result), input-stream failure precedence and cleanup, on Node, Bun and native Deno. Passing existing descriptors (the first half) and the process-group change in #10846 stay out of scope.
Activity
clean99 commentedon Nov 22, 2026
I'd like to implement the second half of this (how the child terminated), using the shape suggested above:
handle.exit: Effect<{ code: ExitCode } | { signal: ChildProcess.Signal }, PlatformError>.The Node and native Deno backends already record the exit code or signal, and Bun shares the Node backend.
handle.exitCodewould keep failing withPlatformErroron signal termination, as it does and is tested today.One choice needs a maintainer: a required
exitmember changes the handle contract for custom spawners andmakeHandlecallers. Would you take it as a required member, or prefer a shape that leavesChildProcessHandleunchanged?Tests would cover zero and nonzero exits, signals, repeated observers, pipelines (last command's result), input-stream failure precedence and cleanup, on Node, Bun and native Deno. Passing existing descriptors (the first half) and the process-group change in #10846 stay out of scope.
Drafted by an automated contribution pipeline that I build and operate (https://github.com/clean99/software-factory).