Use fs.lstat for checking if file is a directory #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of relying on ENOTDIR exceptions.
This fixes weird behavior of Windows when using NFS. In such environment
fs.readdir returns ENOENT instead of ENOTDIR for normal files. This
causes chmodr to fail on the first file. This commit changes
implementation to straightforward checking if path is directory, so it
works on all platforms and filesystems.
Because there are usually more files than directories to chmod,
this is also more performant solution, as it avoids triple system call
for files (fs.readdir, fs.lstat, fs.chmod becomes fs.lstat, fs.chmod),
and uses truple and instead uses triple system call for directories
(fs.readdir, fs.chmod becomes fs.lstat, fs.readdir, fs.chmod).
This commit is a result of debugging failing bower tests on Windows. After this change the the test changing read-only permissions and removing
.git
directory is passing in VM environment (Parallels Desktop 11 on OSX). I hope you'll find time to review it and release it, so I can update bower as well.