Repository navigation
Support duplex additional child-process file descriptors - #8905
Merged
Merged
Conversation
Covers same-fd request/response, POSIX half-close in both directions, and pipeTo preserving a duplex fd target. Implementation follows. Refs EFF-1844, #8902
🦋 Changeset detectedLatest commit: f1ec011 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
tim-smart
requested changes
Oct 8, 2026
| const inputSinks = new Map<number, Sink.Sink<void, Uint8Array, never, PlatformError.PlatformError>>() | ||
| const outputStreams = new Map<number, Stream.Stream<Uint8Array, PlatformError.PlatformError>>() | ||
|
|
||
| const setupInput = Effect.fnUntraced(function*( |
Contributor
There was a problem hiding this comment.
This could use Effect.suspend instead
tim-smart
enabled auto-merge (squash)
October 8, 2026 08:02
tim-smart
approved these changes
Oct 8, 2026
Merged
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 8, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 9, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
Closed
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 10, 2026
tim-smart
pushed a commit
that referenced
this pull request
Oct 13, 2026
effect-bot
added a commit
that referenced
this pull request
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
duplexvariant toChildProcessadditionalFds, so a sidecar can run a request/response protocol over one inherited descriptor.Changes
AdditionalFdConfiggets{ type: "duplex", stream?, sink? }.ChildProcessHandlekeeps its shape:getInputFdandgetOutputFdboth work on a duplex fd, so other spawner implementations are unaffected.DenoChildProcessSpawneralready rejectsadditionalFds.NodeChildProcessSpawnerwires the read stream and the write sink to the samechild.stdio[fd]socket and setsallowHalfOpen = trueon it, so the parent can still write after the child half-closes. When the input sink completes it callsend(), as input fds and stdin already do. On POSIX this is a realshutdown(SHUT_WR).PlatformErrorinstead of hanging.pipeTo(..., { to: "fdN" })no longer replaces a duplex target with{ type: "input" }. The target stays duplex and the piped stream becomes its input.additionalFds,PipeToOptions.toand the handle getters describes the platform support below.Platform support (as documented)
node:child_processcompatibility probes under Node.js and Deno verified same-fd request/response and half-close in both directions; those Deno probes did not validate Effect's spawner. NativeDenoChildProcessSpawnerstill rejectsadditionalFds.end()closes the whole socket. The docs tell users to keep the input open until every response has been read.new net.Socket({ fd })in Node.js and Deno. Deno children can't usenode:fson the raw fd, and Bun children can't usenet.Socketon it.Tests
The final shared spawner suite adds two focused regressions:
pipeToends its input, covering duplex-target preservation and parent half-close on POSIX.Validation
At
1ba3ef7efon Linux / Node 26.8.2:pnpm vitest --runforpackages/platform/node-shared/test,packages/effect/test/processandDenoChildProcessSpawner.test.ts: 202 passed. The native Deno spawner tests do not establish duplex support there.pnpm lintandpnpm check: clean.Earlier validation also passed
pnpm jsdocs --checkand the doctests for the two changed modules (8 passed). A separate manual check under Node and Bun confirmed that an unused duplex write side does not holdexitCodeor the event loop open after the child exits. No macOS or Windows execution was performed.Closes #8902
Closes EFF-1844