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:
parent
4fbefc4283
commit
0df3ea09fa
@ -1398,6 +1398,16 @@ then this will be `null`.
|
|||||||
`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
|
`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
|
||||||
refer to the same value.
|
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()
|
### subprocess.unref()
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.7.10
|
added: v0.7.10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user