doc: add code example to subprocess.stdout

PR-URL: https://github.com/nodejs/node/pull/28402
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Juan José Arboleda authored and Michaël Zasso committed 2019-07-22 21:20:41 +02:00
1 parent 06991cd902
commit cf811ecd47
1 file changed
+10
+10
View File
@@ -1398,6 +1398,16 @@ then this will be `null`.
`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
refer to the same value.
```js
const { spawn } = require('child_process');
const subprocess = spawn('ls');
subprocess.stdout.on('data', (data) => {
console.log(`Received chunk ${data}`);
});
```
### subprocess.unref()
<!-- YAML
added: v0.7.10