-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Description
Is your feature request related to a problem? Please describe.
When using childProcess.execFile(), it returns the child, but there's no way to access the child when using promisify(childProcess.execFile)(). I want to use the promise version for async/await, but I also need to access the child, specifically the .pid.
Describe the solution you'd like
It would be useful if the child could be attached to the promise as a property:
const execFile = promisify(childProcess.execFile);
(async () => {
const promise = execFile('foo');
console.log(promise.child.pid);
await promise;
})();Describe alternatives you've considered
The child could also be returned in the promise result along with stdout and stderr, but there are cases where it would be useful to access the child synchronously.
I could keep using the callback-version, but I don't think that's a good solution. Async/await is the future. The promise version should at least be as powerful as the callback version.
This applies to childProcess.exec too.