Skip to content

Commit

Permalink
Using both lstat and stat in onWatchEvent was unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ArjhanToteck committed Mar 9, 2024
1 parent 289ce5a commit 5b22101
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 @@ -393,7 +393,7 @@ class DirectoryWatcher extends EventEmitter {
if (this.closed) return;
this._activeEvents.set(filename, false);

const handleStats = (err, stats) => {
fs.lstat(filePath, (err, stats) => {
if (this.closed) return;
if (this._activeEvents.get(filename) === true) {
process.nextTick(checkStats);
Expand Down Expand Up @@ -439,15 +439,8 @@ class DirectoryWatcher extends EventEmitter {
false,
eventType
);
if (
this.watcherManager.options.followSymlinks &&
stats.isSymbolicLink()
) {
fs.stat(filePath, handleStats);
}
}
};
fs.lstat(filePath, handleStats);
});
};
process.nextTick(checkStats);
} else {
Expand Down

0 comments on commit 5b22101

Please sign in to comment.