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: workaround misleading node.js ENOENT error #11160

Merged
merged 1 commit into from Feb 21, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Feb 21, 2020

Q                       A
Fixed Issues? Fixes #11130
Patch: Bug Fix? Yes
Tests Added + Pass? No test is added
License MIT

See #11130 (comment)

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: register area: upstream area: node labels Feb 21, 2020
@@ -43,6 +43,9 @@ export function save() {
fs.writeFileSync(FILENAME, serialised);
} catch (e) {
switch (e.code) {
// workaround https://github.com/nodejs/node/issues/31481
// todo: remove the ENOENT error check when we drop node.js 13 support
case "ENOENT":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that it's okay to place ENOENT here because write(2) will never throws ENOENT. http://man7.org/linux/man-pages/man2/write.2.html

So ENOENT must be thrown from fs.mkdirSync(#, { recursive: true }).

@JLHwung JLHwung merged commit a583eab into babel:master Feb 21, 2020
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 23, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: node area: upstream outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: register PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@babel/register write cache fail in node:alpine docker container
4 participants