From 2777c3a8905decb87d1d5ff2e1db22aeeaa63a81 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 21 Feb 2018 11:01:58 -0800 Subject: [PATCH] Close the file watcher if present for the source file --- src/compiler/watch.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 7a98c43dd04..ff21c750089 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -749,6 +749,9 @@ namespace ts { (missingFilePathsRequestedForRelease || (missingFilePathsRequestedForRelease = [])).push(oldSourceFile.path); } else if ((hostSourceFileInfo as FilePresentOnHost).sourceFile === oldSourceFile) { + if ((hostSourceFileInfo as FilePresentOnHost).fileWatcher) { + (hostSourceFileInfo as FilePresentOnHost).fileWatcher.close(); + } sourceFilesCache.delete(oldSourceFile.path); resolutionCache.removeResolutionsOfFile(oldSourceFile.path); }