Skip to content

Commit 6cc1b17

Browse files
committed
Merge pull request #7676 from zhengbli/fixNodeOnSharePoint
Explicitly exclude . and .. for fs.readdirSync
2 parents 55cbdc9 + ddbfb7b commit 6cc1b17

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/compiler/sys.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,11 @@ namespace ts {
498498
const files = _fs.readdirSync(path || ".").sort();
499499
const directories: string[] = [];
500500
for (const current of files) {
501+
// This is necessary because on some file system node fails to exclude
502+
// "." and "..". See https://github.com/nodejs/node/issues/4002
503+
if (current === "." || current === "..") {
504+
continue;
505+
}
501506
const name = combinePaths(path, current);
502507
if (!contains(exclude, getCanonicalPath(name))) {
503508
const stat = _fs.statSync(name);

0 commit comments

Comments
 (0)