mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(compiler-cli): ignore non-existent files
Ignore files that fail fs.exists() rather than throw ENOENT. Some applications deliberately create "broken" symbolic links that are not relevant to compilation (e.g. emacs lock files that link to owner "user@host").
(cherry picked from commit 1628125bcb)
This commit is contained in:
@@ -90,10 +90,18 @@ export function createFileSystemTsReadDirectoryFn(
|
||||
const directories: string[] = [];
|
||||
|
||||
for (const child of children) {
|
||||
if (fs.stat(fs.join(resolvedPath, child))?.isDirectory()) {
|
||||
directories.push(child);
|
||||
} else {
|
||||
files.push(child);
|
||||
try {
|
||||
if (fs.stat(fs.join(resolvedPath, child))?.isDirectory()) {
|
||||
directories.push(child);
|
||||
} else {
|
||||
files.push(child);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.includes('ENOENT')) {
|
||||
// may be a dangling link or other file system error, ignore
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user