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

Child process errors should reject the promise right away #270

Merged
merged 3 commits into from
May 30, 2019

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented May 30, 2019

With #157 and #199 we had the following issue: the top-level promise would not be rejected right away when timing out. It would instead wait for stdout/stderr streams to close first.

We fixed this, but the same problem is still happening with child process errors. If a child process receives an error event, we should reject the promise right away, and not wait for stdout/stderr streams to close first (which might never happen when using a long-running command).

This PR fixes this. As an added bonus, it improves the deferred pattern introduced by #199 that @sindresorhus was warning against.

@ehmicky ehmicky force-pushed the feature/early-errors branch from 0bd1f2c to da77d18 Compare May 30, 2019 13:02
@sindresorhus sindresorhus merged commit 3b8df50 into master May 30, 2019
@sindresorhus
Copy link
Owner

👌

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 this pull request may close these issues.

2 participants