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

Fix timeout option validation #463

Merged
merged 1 commit into from
May 30, 2021
Merged

Fix timeout option validation #463

merged 1 commit into from
May 30, 2021

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented May 30, 2021

Before Node 15.13.0 (link to PR), the timeout was only available in execFile() and exec() but not in spawn(), which is used by Execa.

Execa implemented its own timeout option to fix this. That option probably won't be needed after support for Node 15.13.0 is dropped.

In the meantime, the timeout option added to child_process.spawn() introduces the following inconsistent behavior in Execa depending on the Node.js version:

  • In Node <15.13.0, using an invalid timeout (such as a negative integer) will throw an exception, using Execa's validation logic
  • In Node >=15.13.0, it will return a rejected promise instead, using child_process.spawn() validation logic

This PR fixes this inconsistency by moving Execa's validation logic earlier, before child_process.spawn() is called.

CI tests are failing due to #462.

This was referenced May 30, 2021
@sindresorhus
Copy link
Owner

Can you fix the conflict?

@ehmicky
Copy link
Collaborator Author

ehmicky commented May 30, 2021

Fixed 👍

Some CI tests are failing due to #464 (unrelated to this PR).

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