Skip to content

Commit

Permalink
calling both lstat and stat isnt needed in doScan
Browse files Browse the repository at this point in the history
  • Loading branch information
ArjhanToteck committed Mar 11, 2024
1 parent 5b22101 commit 101507e
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/DirectoryWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ class DirectoryWatcher extends EventEmitter {
}
});
for (const itemPath of itemPaths) {
const handleStats = (err2, stats) => {
fs.stat(itemPath, (err2, stats) => {
if (this.closed) return;
if (err2) {
if (
Expand All @@ -653,12 +653,6 @@ class DirectoryWatcher extends EventEmitter {
true,
"scan (file)"
);
if (
this.watcherManager.options.followSymlinks &&
stats.isSymbolicLink()
) {
fs.stat(itemPath, handleStats);
}
} else if (stats.isDirectory()) {
if (!initial || !this.directories.has(itemPath))
this.setDirectory(
Expand All @@ -669,8 +663,7 @@ class DirectoryWatcher extends EventEmitter {
);
}
itemFinished();
};
fs.lstat(itemPath, handleStats);
});
}
itemFinished();
});
Expand Down

0 comments on commit 101507e

Please sign in to comment.