You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@TomCoded correct, I was suggesting adding that clarification to the util.promisify section:
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 a non-zero status code), a rejected promise is returned, with the same error object given in the
callback, but with an additional two properties stdout and stderr.
@benjamingr Oh, yes, something in the promisify section might be helpful. Perhaps (including any error resulting in an exit code other than 0), to keep the language consistent and to disambiguate from "an error including a non-zero exit code"
@TomCoded would you be interested in submitting such a PR? (If you're unsure how to get started, let me know and we can walk through it on IRC/IM together, I also recommend checking out CONTRIBUTING.md)
@benjamingr Submitted PR. (Thank you for the offer. I believe it worked, but I am still figuring out the system. Please have no qualms about suggestions/criticism.)
Activity
jiripospisil commentedon Mar 20, 2018
I don't think this is an actual bug.
diffreturns1if files differ,0if they're the same.The
execfunction considers any exit code other than0to be an error. Try running the code with the files being the same.benjamingr commentedon Mar 21, 2018
Yes, this is by design, this is also how the callback version works so it doesn't actually have to do with promises.
Try
benjamingr commentedon Mar 21, 2018
Maybe we should add a clarification to the docs: "If the process exits with a non-zero status code the promise is rejected"
TomCoded commentedon Mar 21, 2018
The docs for child_process exec already show that "Any exit code other than 0 is considered to be an error." https://github.com/nodejs/node/blame/master/doc/api/child_process.md#L193
benjamingr commentedon Mar 21, 2018
@TomCoded correct, I was suggesting adding that clarification to the
util.promisifysection:Or something of the sort
njtrettel commentedon Mar 21, 2018
@TomCoded thanks, definitely missed that. I just assumed it would be on a fatal error of some sort, and would have a
stderr.Checking the exit code will be fine.
TomCoded commentedon Mar 22, 2018
@benjamingr Oh, yes, something in the promisify section might be helpful. Perhaps
(including any error resulting in an exit code other than 0), to keep the language consistent and to disambiguate from "an error including a non-zero exit code"benjamingr commentedon Mar 22, 2018
@TomCoded would you be interested in submitting such a PR? (If you're unsure how to get started, let me know and we can walk through it on IRC/IM together, I also recommend checking out CONTRIBUTING.md)
TomCoded commentedon Mar 22, 2018
Will do.
doc: clarify child_process.exec promise rejection on non-zero exit
TomCoded commentedon Mar 22, 2018
@benjamingr Submitted PR. (Thank you for the offer. I believe it worked, but I am still figuring out the system. Please have no qualms about suggestions/criticism.)
Cheers,
Tom
doc: clarify child_process.execFile promise rejection on non-zero exit
doc: clarify child_process promise rejections
doc: clarify child_process promise rejections