doc: clarify stream direction in options.stdio note - #65236
Open
zeexzeex wants to merge 1 commit into
Open
Conversation
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>
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.
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
stdinposition fails withEBADF, while a readable stream works — but readers keep interpreting it from the perspective ofsubprocess.stdin/subprocess.stdoutcreated 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
stdinposition is the source the child reads its input from; the streams in thestdout/stderrpositions receive the output the child writes) and contrasting it explicitly withsubprocess.stdin/subprocess.stdout.Fixes: #56623
Test plan
WriteStreamin thestdinposition fails withEBADF; aReadStreamworksmake lint-md(changed file),core-validate-commit,make doc-only,make test-doc-cipass locally