Skip to content

Commit 0649148

Browse files
AriLFrankelBethGriggs
authored andcommitted
doc: update child_process.md
Add an explanation of the risk of exceeding platform pipe capacity with uncaptured output in child_process.spawn with stdio of pipe PR-URL: #19075 Fixes: #4236 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 18c4e5e commit 0649148

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

doc/api/child_process.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@ ls.on('close', (code) => {
2626
```
2727

2828
By default, pipes for `stdin`, `stdout`, and `stderr` are established between
29-
the parent Node.js process and the spawned child. It is possible to stream data
30-
through these pipes in a non-blocking way. *Note, however, that some programs
31-
use line-buffered I/O internally. While that does not affect Node.js, it can
32-
mean that data sent to the child process may not be immediately consumed.*
29+
the parent Node.js process and the spawned child. These pipes have
30+
limited (and platform-specific) capacity. If the child process writes to
31+
stdout in excess of that limit without the output being captured, the child
32+
process will block waiting for the pipe buffer to accept more data. This is
33+
identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`
34+
option if the output will not be consumed.
35+
It is possible to stream data through these pipes in a non-blocking way. Note,
36+
however, that some programs use line-buffered I/O internally. While that does
37+
not affect Node.js, it can mean that data sent to the child process may not be
38+
immediately consumed.
3339

3440
The [`child_process.spawn()`][] method spawns the child process asynchronously,
3541
without blocking the Node.js event loop. The [`child_process.spawnSync()`][]

0 commit comments

Comments
 (0)