Skip to content

Commit

Permalink
doc: add code example to subprocess.stdout
Browse files Browse the repository at this point in the history
PR-URL: #28402
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
juanarbol authored and targos committed Jul 22, 2019
1 parent 06991cd commit cf811ec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cf811ec

Please sign in to comment.