Skip to content

Commit

Permalink
fix: fix flaky glob behavior with broken symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypicalpro committed Aug 26, 2020
1 parent 5c0bf3a commit 57c0dfd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/file_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ class FileSystem {
}

// Remove all symlinks
return filePaths.filter(filePath => !onlySymlinks[this.normalizePath(filePath)])
const filtered = filePaths.filter(filePath => !onlySymlinks[this.normalizePath(filePath)])

// use lstat on the remaining to filter out broken symlinks
return (await Promise.all(filtered.map(async p => (await fs.promises.lstat(path.resolve(this.targetDir, p))).isSymbolicLink() ? null : p))).filter(p => p)
}

async glob (globs, options) {
Expand Down

0 comments on commit 57c0dfd

Please sign in to comment.