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: allow traversal of symlinks in glob #2134

Merged
merged 2 commits into from Jan 7, 2023

Commits on Jan 4, 2023

  1. fix: allow traversal of symlinks in glob

    Closes TypeStrong#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.
    boneskull committed Jan 4, 2023
    Configuration menu
    Copy the full SHA
    fd7a896 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6c1b4ac View commit details
    Browse the repository at this point in the history