-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow traversal of symlinks in glob
Closes #2130 This adds a `followSymlinks` option to the `glob()` function, and enables it when searching for entry points. If `true`, and a symbolic link is encountered, a stat will be taken of the symlink's target. If a dir or file, the symlink is handled like any other dir or file. If a symbolic link itself (symlink to a symlink), we take a stat of the next until we find a dir or file, then handle it. There is a little bit of caching to avoid extra I/O, and protection from recursive symlinks. However, it's possible (though unlikely) that the FS could cause a "max call stack exceeded" exception. If someone runs into this, we can change the implementation to a loop instead of a recursive function. Apologies for blasting the `do..while`. I love a good `do` myself, but splitting out the lambda functions make it untenable.
- Loading branch information
Showing
3 changed files
with
159 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters