Skip to content
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

Doesn't always return a ChildProcess #275

Closed
MartinKolarik opened this issue Jun 6, 2019 · 2 comments · Fixed by #276
Closed

Doesn't always return a ChildProcess #275

MartinKolarik opened this issue Jun 6, 2019 · 2 comments · Fixed by #276

Comments

@MartinKolarik
Copy link

We get a childP.on is not a function error in our logs occasionally with code like this:

let childP = execa(...);
childP.on('message', ...);

After checking execa's code, I quickly found this, which changes any synchronously thrown errors to promise rejections.

I guess this was done to make it easier to catch all errors via .catch() but it makes it impossible to rely on the returned value and it isn't documented. It's ok if execa extends the error with other properties, but it should be thrown synchronously in this case.

@ehmicky
Copy link
Collaborator

ehmicky commented Jun 6, 2019

Yes @MartinKolarik you're correct, we should throw synchronously instead of returning a rejected promise there. I will submit a PR.

@ehmicky
Copy link
Collaborator

ehmicky commented Jun 6, 2019

PR at #276.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants