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

Make the child process closer to a real Promise #147

Closed
callumlocke opened this issue Aug 8, 2018 · 3 comments
Closed

Make the child process closer to a real Promise #147

callumlocke opened this issue Aug 8, 2018 · 3 comments

Comments

@callumlocke
Copy link

Execa doesn't implement .finally() on the child process. This is making it difficult to come up with a correct Flow type definition for it – see discussion on this PR.

Would you object to adding a .finally() method to execa's spawned child process, to make it fully implement Promise?

The .finally() method is at Stage 4 and is in the latest draft spec.

@sindresorhus
Copy link
Owner

Sure, PR welcome :)

You can use https://github.com/es-shims/Promise.prototype.finally to test it. See: sindresorhus/p-cancelable@870529d

@bradfordlemley
Copy link
Contributor

Would it be possible (or desirable) to define execa as returning an enhanced Promise, rather than an enhanced child process? I.e., extend Promise type like bluebird's flowdef?

There are several defs in flow-typed that extend Promise and that seems like the ideal pattern for Promise compatibility, if possible.

@sindresorhus
Copy link
Owner

Yes, that’s what I would type it as.

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

No branches or pull requests

3 participants