diff options
author | cjihrig <cjihrig@gmail.com> | 2019-06-20 12:10:06 -0400 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-07-02 09:07:46 +0200 |
commit | dd5e07f9b4447f21919aea4688df757225935a21 (patch) | |
tree | 505d395ddb2e6cdce50f398d4f741f52f8c86b4c /doc/api/child_process.md | |
parent | 632fc1faf5aecdf9a2966c4e92e598c613d56a7d (diff) | |
download | android-node-v8-dd5e07f9b4447f21919aea4688df757225935a21.tar.gz android-node-v8-dd5e07f9b4447f21919aea4688df757225935a21.tar.bz2 android-node-v8-dd5e07f9b4447f21919aea4688df757225935a21.zip |
child_process: attach child in promisification
This commit updates the custom exec() and execFile()
promisification to attach the ChildProcess instance to the
returned Promise.
PR-URL: https://github.com/nodejs/node/pull/28325
Fixes: https://github.com/nodejs/node/issues/28244
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Diffstat (limited to 'doc/api/child_process.md')
-rw-r--r-- | doc/api/child_process.md | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/api/child_process.md b/doc/api/child_process.md index b7c0d52a0f..3dc855f604 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -214,10 +214,11 @@ Unlike the exec(3) POSIX system call, `child_process.exec()` does not replace 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 (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`. +a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned +`ChildProcess` instance is attached to the `Promise` as a `child` property. In +case of an 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'); @@ -295,9 +296,10 @@ stderr output. If `encoding` is `'buffer'`, or an unrecognized character 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 (including any error resulting in an exit code other than 0), a rejected -promise is returned, with the same `error` object given in the +a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned +`ChildProcess` instance is attached to the `Promise` as a `child` property. In +case of an 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 |