From 101507e0ff5bd26aff1806e02a643e75569f2ddd Mon Sep 17 00:00:00 2001 From: ArjhanToteck <38510221+ArjhanToteck@users.noreply.github.com> Date: Sat, 9 Mar 2024 17:11:46 -0700 Subject: [PATCH] calling both lstat and stat isnt needed in doScan --- lib/DirectoryWatcher.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/DirectoryWatcher.js b/lib/DirectoryWatcher.js index 104f40a..1429283 100644 --- a/lib/DirectoryWatcher.js +++ b/lib/DirectoryWatcher.js @@ -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 ( @@ -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( @@ -669,8 +663,7 @@ class DirectoryWatcher extends EventEmitter { ); } itemFinished(); - }; - fs.lstat(itemPath, handleStats); + }); } itemFinished(); });