From 465cc5d38e0ef7928e6f2769c329882db9ee7195 Mon Sep 17 00:00:00 2001 From: Avocado Date: Wed, 12 Aug 2026 16:26:50 +0900 Subject: [PATCH] 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 --- doc/api/child_process.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 913542c2dc06..b92fdd7c458c 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1064,7 +1064,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