Skip to content

util.promisify custom implementation of child_process.exec throws away stdout and stderr in case of error #13364

Closed
@giltayar

Description

@giltayar
  • Version: v8.0.0
  • Platform: MacOS
  • Subsystem: child_process

Wrapping child_process.exec-s in util.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 and stderr 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.promisesIssues and PRs related to ECMAScript promises.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions