util.promisify custom implementation of child_process.exec throws away stdout and stderr in case of error #13364
Labels
child_process
Issues and PRs related to the child_process subsystem.
promises
Issues and PRs related to ECMAScript promises.
util
Issues and PRs related to the built-in util module.
Wrapping
child_process.exec
-s inutil.promisify
returns a function that returns stdout and stderr in case there is no error (which is good), but does not return stdout and stderr in case of an error.This means that if the command fails (with exit code != 0) then we have no access to the stdout and stderr (well, we can access stderr in a hackish way through exc.toString(), but that's hackish and still stdout can't be reached).
I suggest attaching
stdout
andstderr
properties to the error returned by the rejected promise. If this is OK with everybody, I can fix it and create a pull request for this.The text was updated successfully, but these errors were encountered: