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: https://github.com/nodejs/node/issues/56623

Signed-off-by: Avocado <ujubongbong@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65236
Fixes: https://github.com/nodejs/node/issues/56623
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Avocado authored and Antoine du Hamel committed 2026-09-09 23:40:24 +02:00
1 parent f07c6acd8b
commit f18be21b14
1 file changed
+6 -1
+6 -1
View File
@@ -1084,7 +1084,12 @@ pipes between the parent and child. The value is one of the following:
as it may result in undefined behavior or dropped callbacks if the stream
encounters errors. Always ensure that `stdin` is used as readable and
`stdout`/`stderr` as writable to maintain the intended flow of data between
the parent and child processes.
the parent and child processes. The stream passed in the `stdin` position
is the source from which the child process reads its input, and the
streams in the `stdout`/`stderr` positions receive the output the child
writes. This is the opposite of [`subprocess.stdin`][] (writable) and
[`subprocess.stdout`][] (readable), which are the parent's ends of the
pipes created by `'pipe'`.
7. Positive integer: The integer value is interpreted as a file descriptor
that is open in the parent process. It is shared with the child
process, similar to how {Stream} objects can be shared. Passing sockets