Skip to content

Commit 5b22101

Browse files
committed
Using both lstat and stat in onWatchEvent was unnecessary
1 parent 289ce5a commit 5b22101

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

lib/DirectoryWatcher.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class DirectoryWatcher extends EventEmitter {
393393
if (this.closed) return;
394394
this._activeEvents.set(filename, false);
395395

396-
const handleStats = (err, stats) => {
396+
fs.lstat(filePath, (err, stats) => {
397397
if (this.closed) return;
398398
if (this._activeEvents.get(filename) === true) {
399399
process.nextTick(checkStats);
@@ -439,15 +439,8 @@ class DirectoryWatcher extends EventEmitter {
439439
false,
440440
eventType
441441
);
442-
if (
443-
this.watcherManager.options.followSymlinks &&
444-
stats.isSymbolicLink()
445-
) {
446-
fs.stat(filePath, handleStats);
447-
}
448442
}
449-
};
450-
fs.lstat(filePath, handleStats);
443+
});
451444
};
452445
process.nextTick(checkStats);
453446
} else {

0 commit comments

Comments
 (0)