Skip to content

Commit d046fb4

Browse files
authored
doc: clarify stream direction in options.stdio note
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 #62175), so spell out the data flow and the contrast explicitly. Fixes: #56623 Signed-off-by: Avocado <ujubongbong@gmail.com> PR-URL: #65236 Fixes: #56623 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 36a4502 commit d046fb4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

doc/api/child_process.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,12 @@ pipes between the parent and child. The value is one of the following:
10841084
as it may result in undefined behavior or dropped callbacks if the stream
10851085
encounters errors. Always ensure that `stdin` is used as readable and
10861086
`stdout`/`stderr` as writable to maintain the intended flow of data between
1087-
the parent and child processes.
1087+
the parent and child processes. The stream passed in the `stdin` position
1088+
is the source from which the child process reads its input, and the
1089+
streams in the `stdout`/`stderr` positions receive the output the child
1090+
writes. This is the opposite of [`subprocess.stdin`][] (writable) and
1091+
[`subprocess.stdout`][] (readable), which are the parent's ends of the
1092+
pipes created by `'pipe'`.
10881093
7. Positive integer: The integer value is interpreted as a file descriptor
10891094
that is open in the parent process. It is shared with the child
10901095
process, similar to how {Stream} objects can be shared. Passing sockets

0 commit comments

Comments
 (0)