fix(ext/node): forward stdout from worker_threads to parent#32160
Merged
bartlomieju merged 3 commits intodenoland:mainfrom Feb 14, 2026
Merged
fix(ext/node): forward stdout from worker_threads to parent#32160bartlomieju merged 3 commits intodenoland:mainfrom
bartlomieju merged 3 commits intodenoland:mainfrom
Conversation
Previously only stderr was forwarded from worker threads to the parent. This adds stdout forwarding using the same mechanism, enabling worker.stdout to emit data events when the worker writes to process.stdout. Also adds the stdin property (null by default) to match Node.js Worker API surface. Enables test-worker-no-stdin-stdout-interaction.js node_compat test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…able for worker stdio The execArgv validation was treating all array elements as flags, but items like "node" and "development" are arguments to preceding flags (e.g. "--conditions node"). Skip items that don't start with '-'. Also upgrade worker.stdout and worker.stderr from EventEmitter to Readable streams to match the Node.js API (supporting pipe/unpipe). Close stdio streams when the worker exits. This fixes vitest 4 compatibility where threads pool passes "--conditions node --conditions development" in execArgv and calls worker.stdout.pipe(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
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.
Closes #31889
Summary
stdoutandstderrasReadablestreams on theWorkerclass, andstdin(null by default), matching the Node.js API surfaceprocess.stdout.write()andprocess.stderr.write()from worker threads to the parent via internal messages, soworker.stdout/worker.stderremit data and support.pipe()push(null)when the worker exitsexecArgvvalidation to skip non-flag arguments (e.g."node"and"development"in--conditions node --conditions development)test-worker-no-stdin-stdout-interaction.jsnode_compat testTest plan
cargo test --test node_compat parallel -- --filter test-worker-no-stdin-stdout-interaction.jscargo test --test node_compat parallel -- --filter test-worker-execargv(no regression)🤖 Generated with Claude Code