-
Notifications
You must be signed in to change notification settings - Fork 774
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
Fixes fs-extra on linux #520
Conversation
@arcanis Thanks for the PR. What kind of Linux are you running when you get this error? What filesystem? I'm on Linux myself, but I've never had this problem, though I can see it could happen, looking at the Node.js code. |
lib/fs/index.js
Outdated
// Some commands are not available on some systems. Ex: | ||
// fs.copyFile was added in Node.js v8.5.0 | ||
// fs.mkdtemp was added in Node.js v5.10.0 | ||
// fs.lchown is not available on Linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// fs.lchown is not available on some computers
It isn't unavailable on all Linux.
lib/fs/index.js
Outdated
// fs.copyFile was added in Node.js v8.5.0 | ||
// fs.mkdtemp was added in Node.js v5.10.0 | ||
// fs.lchown is not available on Linux | ||
return fs[key] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for consistency with the previous code, to prevent possible regressions, can we change this to
return typeof fs[key] === 'function'
?
Also, please squash into one commit. |
I'm not too sure. I think O_SYMLINK is supposed to only be present on BSD-based systems, at least according to nodejs/node-v0.x-archive#3598 and nodejs/node-v0.x-archive#2142 (comment). Will make the requested changes. |
@arcanis Thanks! |
The
lchown
function is not available on some systems. Usingfs-extra
there causes a crash:This PR makes sure that all commands exist before trying to convert them.