From 8e3f59fbb5f9f2099561187116245bb541e27458 Mon Sep 17 00:00:00 2001 From: TomCoded Date: Thu, 22 Mar 2018 21:11:28 +0000 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/19541 Fixes: https://github.com/nodejs/node/issues/19494 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell --- doc/api/child_process.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index be74f1fde76dc0..07d3b9ac0e8773 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -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'); @@ -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