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

Convert to util.promisify and async/await #25

Merged
merged 1 commit into from
May 12, 2019

Conversation

paulmelnikow
Copy link
Collaborator

Ref #23 (comment)

Rather than wrapping the callback generically, it seems clearest to produce the correct output value all at once.

I'm getting a test failure locally on withDir, though I have the same failure in master. Any ideas what's causing that?

Copy link
Owner

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a bunch, this generally LGTM.

Need to shim Promise.prototype.finally since it's only available on Node 10+

@paulmelnikow
Copy link
Collaborator Author

If we're targeting Node 8+, Is there any reason not to write withFile and withDir using async / await?

@benjamingr
Copy link
Owner

If we're targeting Node 8+, Is there any reason not to write withFile and withDir using async / await?

Not at all, change to async/await welcome. We can just use regular finally instead of .finally in that case.

@paulmelnikow
Copy link
Collaborator Author

Updated!

The await in the finally block fixes the failing test – which it appears was a real failure 😲

@paulmelnikow paulmelnikow changed the title Convert to util.promisify Convert to util.promisify and async/await May 10, 2019
@benjamingr
Copy link
Owner

Looks great, thanks.

@benjamingr
Copy link
Owner

I have invited you to the project by the way. With the other maintainers being @whmountains and @dlee-nvisia :]

@benjamingr benjamingr merged commit 64cd979 into benjamingr:master May 12, 2019
@benjamingr
Copy link
Owner

benjamingr commented May 12, 2019

Published 2.0 (wanted to be on the safe side)

@paulmelnikow paulmelnikow deleted the util-promisify branch May 13, 2019 04:02
@paulmelnikow
Copy link
Collaborator Author

Thank you! Look forward to helping.

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