Skip to content

Commit

Permalink
Merge 3edd5c5 into 76b0e4a
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jan 9, 2019
2 parents 76b0e4a + 3edd5c5 commit 1fea188
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/DirectoryWatcher.js
Expand Up @@ -332,6 +332,14 @@ class DirectoryWatcher extends EventEmitter {

onWatchEvent(eventType, filename) {
if(this.closed) return;
if(!filename) {
// In some cases no filename is provided
// This seem to happen on windows
// So some event happened but we don't know which file is affected
// We have to do a full scan of the directory
this.doScan(false);
return;
}
if(this._activeEvents.get(filename) === undefined) {
this._activeEvents.set(filename, false);
const checkStats = () => {
Expand Down Expand Up @@ -494,6 +502,12 @@ class DirectoryWatcher extends EventEmitter {
this.setMissing(file, initial, "scan (missing)");
}
}
if(this.scanAgain) {
// Early repeat of scan
this.scanAgain = false;
this.doScan(initial);
return;
}
async.forEach(itemPaths, (itemPath, callback) => {
fs.stat(itemPath, (err2, stats) => {
if(this.closed) return;
Expand Down

0 comments on commit 1fea188

Please sign in to comment.