-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get rejected promise instead of output.stderr #98
Comments
That section says:
It's hard for me to tell how you interpreted that section... However, you have a point, it is tempting to make the promise resolve to just |
I understand your premise about You make a good point about APIs breaking changes. But I would have it sooner than later as it simplifies coding design a whole lot simpler. :) |
Throwing my two cents here... I agree with @jedwards1211 that a child process can write to A convention with shell scripts is to log information to For CI/CD scripts, I use |
Yeah don't worry, I would never make it reject just because |
Can you give me a link to where you read about this? I'm assuming you read that node will output to |
👍
Personally, I think the API is fine how you have it. Using destructuring I can grab just stdout, stderr, or the whole response in one statement. const response = await exec(...);
const { stdout, stderr } = await exec(...);
const { stdout } = await exec(...); |
Right, it would basically save a few keystrokes. I am about saving keystrokes, but... another thing is it's possible to use a wrapper function to return stdout directly (maybe I should export one). |
@jedwards1211 ,
This is more like a question/suggestion than issue.
Currently, the library returns an object with
{stderr: string| undefined, stdout: string|undefined}
. I think it would make more sense, since it is promise based, if it returns a rejected promise instead ofstderr
. That way, the consumer does not have to look forstderr
specifically but they can use acatch
block instead and get a single string instdout
instead of object. I think that would simplify a lot of code and would improve readability.So question is, was there there any specific reason it is not implemented? Can this be taken under consideration and implemented?
Also this section says, it will return rejected promise in case of error which I think is misleading/confusing.
The text was updated successfully, but these errors were encountered: