ChildProcess: support bidirectional (duplex) additional file descriptors
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #8905 de @effect-bot — fusionado
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- node.js, typescript
- Área
- backend
Línea de trabajo
Start from the ChildProcessOptions.additionalFds type and NodeChildProcessSpawner implementation in the platform-node-shared package. Add a duplex variant to AdditionalFdConfig that provides both a Stream and a Sink for the same descriptor, then extend ChildProcessHandle with a getDuplexFd method. Verify the change with the existing child process test suite.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What is the problem this feature would solve?
ChildProcessOptions.additionalFds only lets you configure each extra descriptor in one direction:
type AdditionalFdConfig =
| { readonly type: "input"; readonly stream?: Stream<Uint8Array, PlatformError> }
| { readonly type: "output"; readonly sink?: Sink<Uint8Array, Uint8Array, never, PlatformError> }
The Node spawner (@effect/platform-node-shared/NodeChildProcessSpawner) sets each configured fd to "pipe". For fd ≥ 3, Node backs that with a bidirectional Unix domain socket. Effect then exposes it either as a Sink (getInputFd) or as a Stream (getOutputFd), never both. And because additionalFds is keyed by fd name, one descriptor can't be declared as both input and output.
So there's no way to run a request/response protocol between parent and child over a single inherited socket, e.g. a sidecar speaking a framed protocol on fd 3. Code that needs this has to call node:child_process spawn with stdio: [..., "pipe"] directly and drive child.stdio[3] itself. That means giving up ChildProcessSpawner and doing manual lifecycle, exit and error handling plus raw event listeners. The workaround of using two descriptors (fd 3 in, fd 4 out) changes the child's protocol contract and isn't always an option.
What is the feature you are proposing to solve the problem?
Add a duplex variant to AdditionalFdConfig, for example:
additionalFds: { fd3: { type: "duplex" } }
ChildProcessHandle would then expose both directions for that fd, e.g. a getDuplexFd(fd) that returns { stream, sink }. Alternatively, getInputFd and getOutputFd could both work on the same "duplex" descriptor.
What alternatives have you considered?
- Using
node:child_processspawndirectly and drivingchild.stdio[3]manually, which is what we do today. - Splitting the protocol across two unidirectional descriptors. This needs a change on the child side and doesn't match socket semantics such as half-close and shutdown.
Version: [email protected], @effect/[email protected].
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 9 h 39 min
- PR fusionados (30 d)
- 703
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
BrowserWorkerRunner: port finalizer throws when the worker global has no close() (Bun)Posiblemente ocupada @santiago-ramos-02 la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Effect-TS/effect#8635 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Support {self: this} for fnUntracedQuizá libre de nuevo @ArjunCodess la tomó hace 28 días y no hay ningún pull request abierto. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Effect-TS/effect#8101 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
OpenApi: optional query and header parameters are documented as nullablePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
Los mantenedores suelen responder en 1 día
-
RpcClient keeps the entries of requests that fail without a replyPosiblemente ocupada @schutzelaars la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
NodeSink.fromWritable hangs forever when the Writable finishes before every chunk is writtenPosiblemente ocupada @effect-bot la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
area:security documentation effort:S priority:P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
app:web meta:ops
Dificultad 2/5 Medio día Aptitud para principiantes 78/100
osu-tournament-rating/otr#1113 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
typegoose/mongodb-memory-server#1040 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100