Skip to content

doc: clarify stream direction in options.stdio note - #65236

Open
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:doc/child-process-stdio-stream-direction
Open

doc: clarify stream direction in options.stdio note#65236
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:doc/child-process-stdio-stream-direction

Conversation

@zeexzeex

Copy link
Copy Markdown

Description

Clarify the stream-direction note under options.stdio (item 6, {Stream} object).

The note was added in #55322 with two sentences that contradicted each other, and #56623 was filed against that text. #60114 later fixed the contradiction, but did not reference the issue, so it stayed open.

The remaining wording is correct — a write-only stream in the stdin position fails with EBADF, while a readable stream works — but readers keep interpreting it from the perspective of subprocess.stdin/subprocess.stdout created by 'pipe', whose directions are the opposite. The issue reporter, the author of the self-closed #62175, and a later commenter all inverted it the same way.

This adds two sentences spelling out the data flow (the stream in the stdin position is the source the child reads its input from; the streams in the stdout/stderr positions receive the output the child writes) and contrasting it explicitly with subprocess.stdin/subprocess.stdout.

Fixes: #56623

Test plan

  • Verified the behavior locally: a WriteStream in the stdin position fails with EBADF; a ReadStream works
  • make lint-md (changed file), core-validate-commit, make doc-only, make test-doc-ci pass locally
  • CI / doc lint on this PR

The stdio array note describes the stream passed for stdin as readable
and stdout/stderr as writable, which is the reverse of the
subprocess.stdin/subprocess.stdout streams created by 'pipe'. Readers
keep conflating the two perspectives (see the linked issue and the
self-closed PR nodejs#62175), so spell out the data flow and the contrast
explicitly.

Fixes: nodejs#56623

Signed-off-by: Avocado <ujubongbong@gmail.com>
@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mixing with stdin and stderr stdout about readable or writable in Child process spawn API options.stdio doc

2 participants