File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,7 @@ public function build(): self
273273 $ this ->_watchingDirectory = false ;
274274
275275 $ this ->_lastModTimeCache = array ();
276+ $ this ->_filesCache = array ();
276277
277278 if ($ this ->_fs ->isDir ($ this ->_path )) {
278279 $ this ->_filesCache = $ this ->_fs ->readDir ($ this ->_path , $ this ->_recursive );
@@ -433,7 +434,11 @@ private function _watchFile(string $_path)
433434 private function _cacheLastModTimes ()
434435 {
435436 foreach ($ this ->_filesCache as $ name => $ path ) {
436- $ this ->_lastModTimeCache [$ path ] = $ this ->_lmt ($ path );
437+ // If the file got deleted during from the listener,
438+ // or during the process but after scanning for changes.
439+ if ($ this ->_fs ->exists ($ path )) {
440+ $ this ->_lastModTimeCache [$ path ] = $ this ->_lmt ($ path );
441+ }
437442 }
438443 }
439444
@@ -445,7 +450,7 @@ private function _lmt(string $path): int
445450 private function _addForWatch (string $ path )
446451 {
447452 $ p = $ this ->_fs ->cleanPath ($ path );
448- $ this ->_filesCache = array ( $ path => $ p) ;
453+ $ this ->_filesCache [ $ path] = $ p ;
449454 $ this ->_lastModTimeCache [$ p ] = $ this ->_lmt ($ p );
450455 }
451456
You can’t perform that action at this time.
0 commit comments