ChildProcess: support bidirectional (duplex) additional file descriptors
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #8905 @effect-bot による — マージ済み
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- node.js, typescript
- 領域
- backend
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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].
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 11時間 28分
- マージ済み PR(30日)
- 490
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
Effect-TS/effect#8863 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
BrowserWorkerRunner: port finalizer throws when the worker global has no close() (Bun)対応中かも @santiago-ramos-02 が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Effect-TS/effect#8635 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Support {self: this} for fnUntraced再び着手できるかも @ArjunCodess が 20 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Effect-TS/effect#8101 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
add Effect-native McpClient対応中かも @lloydrichards が 2 日前に担当しました。 オープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
Effect-TS/effect#8912 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
MystenLabs/MemWal#1163 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Mondriaan
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
knaw-huc/textannoviz#709 ·
メンテナーはふだん 1 日以内に返信
-
billion-context-pi
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ranxianglei/billion-context#2521 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Add: YRF Music Nepalオープンstreams:add
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100