Create and restore ATOM_HOME for the socket stuff

This commit is contained in:
Ash Wilson 2019-04-19 12:03:58 -04:00
parent ad2b431c5c
commit 1ba571becd
No known key found for this signature in database
GPG Key ID: 81B1DDB704F69D2A

View File

@ -669,10 +669,12 @@ class LaunchScenario {
this.applications = new Set()
this.windows = new Set()
this.root = null
this.atomHome = null
this.projectRootPool = new Map()
this.filePathPool = new Map()
this.killedPids = []
this.originalAtomHome = null
}
async init () {
@ -686,6 +688,15 @@ class LaunchScenario {
})
})
this.atomHome = path.join(this.root, '.atom')
await new Promise((resolve, reject) => {
fs.makeTree(this.atomHome, err => {
if (err) { reject(err) } else { resolve() }
})
})
this.originalAtomHome = process.env.ATOM_HOME
process.env.ATOM_HOME = this.atomHome
await Promise.all(
['a', 'b', 'c'].map(dirPath => new Promise((resolve, reject) => {
const fullDirPath = path.join(this.root, dirPath)
@ -884,6 +895,10 @@ class LaunchScenario {
await Promise.all(
Array.from(this.applications, app => app.destroy())
)
if (this.originalAtomHome) {
process.env.ATOM_HOME = this.originalAtomHome
}
}
addApplication (options = {}) {