Skip to content

Commit 0df3ea0

Browse files
juanarbolTrott
authored andcommitted
doc: add code example to subprocess.stdout
PR-URL: nodejs#28402 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 4fbefc4 commit 0df3ea0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/api/child_process.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,16 @@ then this will be `null`.
13981398
`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
13991399
refer to the same value.
14001400

1401+
```js
1402+
const { spawn } = require('child_process');
1403+
1404+
const subprocess = spawn('ls');
1405+
1406+
subprocess.stdout.on('data', (data) => {
1407+
console.log(`Received chunk ${data}`);
1408+
});
1409+
```
1410+
14011411
### subprocess.unref()
14021412
<!-- YAML
14031413
added: v0.7.10

0 commit comments

Comments
 (0)