mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 20:14:01 -06:00
Protect watcher from double close (#49990)
This commit is contained in:
parent
455ea9b41f
commit
4e23f515e0
@ -1088,14 +1088,16 @@ namespace ts {
|
||||
lastDirectoryPart = lastDirectoryPartWithDirectorySeparator.slice(directorySeparator.length);
|
||||
}
|
||||
/** Watcher for the file system entry depending on whether it is missing or present */
|
||||
let watcher = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
||||
let watcher: FileWatcher | undefined = !fileSystemEntryExists(fileOrDirectory, entryKind) ?
|
||||
watchMissingFileSystemEntry() :
|
||||
watchPresentFileSystemEntry();
|
||||
return {
|
||||
close: () => {
|
||||
// Close the watcher (either existing file system entry watcher or missing file system entry watcher)
|
||||
watcher.close();
|
||||
watcher = undefined!;
|
||||
if (watcher) {
|
||||
watcher.close();
|
||||
watcher = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user