Skip to content

Commit

Permalink
doc: clarify child_process promise rejections
Browse files Browse the repository at this point in the history
Promisify sections of `child_process.exec()`
and `child_process.execFile()` changed to make clear
that non-zero exit codes will result in promise rejection.

PR-URL: #19541
Fixes: #19494
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
TomCoded authored and targos committed Mar 24, 2018
1 parent 40916a2 commit 8e3f59f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ the existing process and uses a shell to execute the command.

If this method is invoked as its [`util.promisify()`][]ed version, it returns
a Promise for an object with `stdout` and `stderr` properties. In case of an
error, a rejected promise is returned, with the same `error` object given in the
callback, but with an additional two properties `stdout` and `stderr`.
error (including any error resulting in an exit code other than 0), a rejected
promise is returned, with the same `error` object given in the callback, but
with an additional two properties `stdout` and `stderr`.

```js
const util = require('util');
Expand Down Expand Up @@ -301,7 +302,8 @@ encoding, `Buffer` objects will be passed to the callback instead.

If this method is invoked as its [`util.promisify()`][]ed version, it returns
a Promise for an object with `stdout` and `stderr` properties. In case of an
error, a rejected promise is returned, with the same `error` object given in the
error (including any error resulting in an exit code other than 0), a rejected
promise is returned, with the same `error` object given in the
callback, but with an additional two properties `stdout` and `stderr`.

```js
Expand Down

0 comments on commit 8e3f59f

Please sign in to comment.