mirror of
https://github.com/atom/atom.git
synced 2026-01-15 01:48:15 -05:00
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:
6
package-lock.json
generated
6
package-lock.json
generated
@@ -744,9 +744,9 @@
|
||||
}
|
||||
},
|
||||
"@atom/notify": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@atom/notify/-/notify-1.0.3.tgz",
|
||||
"integrity": "sha512-ZS+feBkSULIDQIQnYr4OdplH7UNzpAwHqv9dsfDjgtALuLVUnzL2SdBkvjX5LTMGiZkFRLs3Cbly25LdNGIBlQ=="
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@atom/notify/-/notify-1.0.4.tgz",
|
||||
"integrity": "sha512-9tIf60zM0MSyEHzlH3NrMUeC6BJNrJyIzvLXK/UaW9HEeXWRayxBOGNkrKN9JfEYuabOsDoNdVqdo8HE16Wpfw=="
|
||||
},
|
||||
"@atom/nsfw": {
|
||||
"version": "1.0.18",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"license": "MIT",
|
||||
"electronVersion": "2.0.18",
|
||||
"dependencies": {
|
||||
"@atom/notify": "1.0.3",
|
||||
"@atom/notify": "1.0.4",
|
||||
"@atom/nsfw": "1.0.18",
|
||||
"@atom/source-map-support": "^0.3.4",
|
||||
"@atom/watcher": "1.3.1",
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('Project', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('does not deserialize paths that are now files', () => {
|
||||
it('does not deserialize paths that are now files', async () => {
|
||||
const childPath = path.join(temp.mkdirSync('atom-spec-project'), 'child')
|
||||
fs.mkdirSync(childPath)
|
||||
|
||||
@@ -70,22 +70,21 @@ describe('Project', () => {
|
||||
grammarRegistry: atom.grammars
|
||||
})
|
||||
atom.project.setPaths([childPath])
|
||||
await stopAllWatchers()
|
||||
const state = atom.project.serialize()
|
||||
|
||||
fs.rmdirSync(childPath)
|
||||
fs.writeFileSync(childPath, 'surprise!\n')
|
||||
|
||||
let err = null
|
||||
waitsForPromise(() =>
|
||||
deserializedProject.deserialize(state, atom.deserializers).catch(e => {
|
||||
err = e
|
||||
})
|
||||
)
|
||||
try {
|
||||
await deserializedProject.deserialize(state, atom.deserializers)
|
||||
} catch (e) {
|
||||
err = e
|
||||
}
|
||||
|
||||
runs(() => {
|
||||
expect(deserializedProject.getPaths()).toEqual([])
|
||||
expect(err.missingProjectPaths).toEqual([childPath])
|
||||
})
|
||||
expect(deserializedProject.getPaths()).toEqual([])
|
||||
expect(err.missingProjectPaths).toEqual([childPath])
|
||||
})
|
||||
|
||||
it('does not include unretained buffers in the serialized state', () => {
|
||||
|
||||
@@ -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())
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user