Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doc: fix exec example in child_process
Previously, the example was checking for error by strict equality to
null. The error could be undefined though which would fail that check.

PR-URL: #6660
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Jeremy Whitlock <[email protected]>
  • Loading branch information
evanlucas committed May 13, 2016
commit d13b9d3f7f59f0be279226bbcde622cceccda369
14 changes: 7 additions & 7 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ generated output.

```js
const exec = require('child_process').exec;
const child = exec('cat *.js bad_file | wc -l',
(error, stdout, stderr) => {
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
if (error !== null) {
console.log(`exec error: ${error}`);
}
exec('cat *.js bad_file | wc -l', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
});
```

Expand Down