mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00: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:
parent
1cdcd5a947
commit
bc34083d34
1 changed files with 12 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue