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-dir should preserve EACCES error #25

Open
JLHwung opened this issue Feb 20, 2020 · 3 comments
Open

make-dir should preserve EACCES error #25

JLHwung opened this issue Feb 20, 2020 · 3 comments

Comments

@JLHwung
Copy link

JLHwung commented Feb 20, 2020

Reproduction step on macOS

mkdir -m 0100 foo
node -e "require('fs').mkdirSync('foo/bar')"
# Error: EACCES

node -e "require('make-dir').sync('foo/bar')"
# Error: ENOENT

Expect: make-dir should align to fs and throw EACCES error.
Actual: The error codes differ.

Additional Context: babel/babel#11130

@sindresorhus
Copy link
Owner

Does the built-in fs.mkdir method with the recursive option do that? Because we’re trying to keep the behavior the same.

@JLHwung
Copy link
Author

JLHwung commented Feb 20, 2020

Thanks for the prompt reply. I just realize that the builtin fs.mkdir returns ENOENT while mkdir returns EACCES. I think I should file to node.js instead.

@JLHwung JLHwung closed this as completed Feb 20, 2020
@JLHwung
Copy link
Author

JLHwung commented Feb 20, 2020

Node.js has fixed this issue in the master branch nodejs/node#31481

I think we should align to the new behaviour.

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

2 participants