Skip to content

Commit 8e3f59f

Browse files
TomCodedtargos
authored andcommitted
doc: clarify child_process promise rejections
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 <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 40916a2 commit 8e3f59f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/api/child_process.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ the existing process and uses a shell to execute the command.
223223

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

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

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

307309
```js

0 commit comments

Comments
 (0)