Skip to content

Explicitly exclude . and .. for fs.readdirSync#7676

Merged
zhengbli merged 2 commits into
microsoft:masterfrom
zhengbli:fixNodeOnSharePoint
Mar 24, 2016
Merged

Explicitly exclude . and .. for fs.readdirSync#7676
zhengbli merged 2 commits into
microsoft:masterfrom
zhengbli:fixNodeOnSharePoint

Conversation

@zhengbli
Copy link
Copy Markdown

Fixes #7469

Exclude "." and ".." from the fs.readdir result explicitly due to the node bug that in some cases it fails to exclude these two items. (See microsoft/vscode#3860 and nodejs/node#4002)

Comment thread src/compiler/sys.ts
const files = filter(<string[]>_fs.readdirSync(path || "."), f => f !== "." && f !== "..").sort();
const directories: string[] = [];
for (const current of files) {
const name = combinePaths(path, current);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about if (current === "." || current === "..") continue; instead of the filter.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better. Updated.

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Mar 24, 2016

👍

@zhengbli zhengbli merged commit 6cc1b17 into microsoft:master Mar 24, 2016
@zhengbli zhengbli deleted the fixNodeOnSharePoint branch March 24, 2016 23:08
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants