Skip to content

fix(ext/node): make child_process stdio streams Socket instances#31975

Merged
fraidev merged 4 commits intodenoland:mainfrom
fraidev:fix-child-process-stdio-socket-instance
Feb 2, 2026
Merged

fix(ext/node): make child_process stdio streams Socket instances#31975
fraidev merged 4 commits intodenoland:mainfrom
fraidev:fix-child-process-stdio-socket-instance

Conversation

@fraidev
Copy link
Copy Markdown
Contributor

@fraidev fraidev commented Jan 29, 2026

Closes #31961
Closes #25602

This PR fixes child process stdio streams (stdin, stdout, stderr) to be instances of Socket from node:net, matching Node.js behavior.

@fraidev fraidev added the ci-draft Run the CI on draft PRs. label Jan 29, 2026
@fraidev fraidev force-pushed the fix-child-process-stdio-socket-instance branch from e58d5f4 to 41e4f03 Compare January 29, 2026 02:52
@fraidev fraidev force-pushed the fix-child-process-stdio-socket-instance branch from 41e4f03 to 11ea6da Compare January 29, 2026 13:41
@fraidev fraidev marked this pull request as ready for review January 29, 2026 14:32
@fraidev fraidev removed the ci-draft Run the CI on draft PRs. label Jan 29, 2026
@@ -164,18 +167,46 @@ class StreamResource implements StreamBase {
}
async read(p: Uint8Array): Promise<number | null> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if this gets called multiple times? Is that possible? If so then you will overwrite pending promise

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I changed to use a Set of it instead

}
write(p: Uint8Array): Promise<number> {
return core.write(this.#rid, p);
async write(p: Uint8Array): Promise<number> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@bartlomieju bartlomieju changed the title fix(node/child_process): make stdio streams Socket instances fix(ext/node): make child_process stdio streams Socket instances Jan 29, 2026
@fraidev fraidev requested a review from bartlomieju February 1, 2026 03:03
Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fraidev fraidev merged commit 0b38d25 into denoland:main Feb 2, 2026
21 checks passed
@AgentEnder
Copy link
Copy Markdown

Awesome! Thanks yall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants