Stop all watchers before attempting to replace directory with file

I think that the notify subprocess might be holding a lock on the 
watched directory on Windows.
This commit is contained in:
Nathan Sobo
2019-05-03 14:11:59 -06:00
parent 1ec8e7730b
commit 5bfbdd2bce
4 changed files with 16 additions and 18 deletions

View File

@@ -606,13 +606,12 @@ class PathWatcherManager {
// Private: Stop all living watchers.
//
// Returns a {Promise} that resolves when all native watcher resources are disposed.
stopAllWatchers () {
async stopAllWatchers () {
if (this.useExperimentalWatcher()) {
this.notifyWatcher.kill()
await this.notifyWatcher.kill()
this.notifyWatcher = null
return Promise.resolve()
} else {
return Promise.all(
await Promise.all(
Array.from(this.live, ([, w]) => w.stop())
)
}