dispose the watched wild card directories only if present

This commit is contained in:
Sheetal Nandi
2017-07-27 16:30:22 -07:00
parent 476157fab8
commit c2d0d533c4
2 changed files with 32 additions and 4 deletions

View File

@@ -1134,10 +1134,12 @@ namespace ts.server {
this.typeRootsWatchers = undefined;
}
this.directoriesWatchedForWildcards.forEach(watcher => {
watcher.close();
});
this.directoriesWatchedForWildcards = undefined;
if (this.directoriesWatchedForWildcards) {
this.directoriesWatchedForWildcards.forEach(watcher => {
watcher.close();
});
this.directoriesWatchedForWildcards = undefined;
}
this.stopWatchingDirectory();
}