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(ext/node): fix no arg call of fs.promises.readFile #22030

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Jan 22, 2024

We use util.promisify for creating fs.promises.readFile, but that doesn't support the case when it's called with no args (With no arg call, promisify passes the callback as the first arg of fs.readFile, and that is not supported). As reported in #21795, isomorphic-git uses fs.promises.readFile() for checking the availability of fs.promises, and that causes an uncaught error.

This PR fixes the above by avoiding to use promisify, but using more primitive wrapper structure for creating promise version of readFile.

See also the comment #21795 (comment)

closes #21795

@kt3k kt3k force-pushed the fix-fs-promises-read-file-no-arg branch from 16afaf9 to 8e32e99 Compare January 22, 2024 15:44
@kt3k kt3k marked this pull request as ready for review January 22, 2024 15:52
@kt3k kt3k requested a review from bartlomieju January 22, 2024 15:53
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, nice fix!

@kt3k kt3k merged commit 2af0c0a into denoland:main Jan 23, 2024
17 checks passed
@kt3k kt3k deleted the fix-fs-promises-read-file-no-arg branch January 23, 2024 03:59
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.

node:fs incompatibility with readFile() breaks isomorphic-git
2 participants