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 Rich Trott committed 2019-07-20 12:42:37 -07:00
1 parent 4fbefc4283
commit 0df3ea09fa
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