mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
doc: add note about stdio streams in child_process
PR-URL: https://github.com/nodejs/node/pull/55322 Fixes: https://github.com/nodejs/node/issues/15714 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
5983110545
commit
1c2eecd669
@ -1061,6 +1061,15 @@ pipes between the parent and child. The value is one of the following:
|
|||||||
corresponds to the index in the `stdio` array. The stream must have an
|
corresponds to the index in the `stdio` array. The stream must have an
|
||||||
underlying descriptor (file streams do not start until the `'open'` event has
|
underlying descriptor (file streams do not start until the `'open'` event has
|
||||||
occurred).
|
occurred).
|
||||||
|
**NOTE:** While it is technically possible to pass `stdin` as a writable or
|
||||||
|
`stdout`/`stderr` as readable, it is not recommended.
|
||||||
|
Readable and writable streams are designed with distinct behaviors, and using
|
||||||
|
them incorrectly (e.g., passing a readable stream where a writable stream is
|
||||||
|
expected) can lead to unexpected results or errors. This practice is discouraged
|
||||||
|
as it may result in undefined behavior or dropped callbacks if the stream
|
||||||
|
encounters errors. Always ensure that `stdin` is used as writable and
|
||||||
|
`stdout`/`stderr` as readable to maintain the intended flow of data between
|
||||||
|
the parent and child processes.
|
||||||
7. Positive integer: The integer value is interpreted as a file descriptor
|
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
|
that is open in the parent process. It is shared with the child
|
||||||
process, similar to how {Stream} objects can be shared. Passing sockets
|
process, similar to how {Stream} objects can be shared. Passing sockets
|
||||||
|
Loading…
Reference in New Issue
Block a user