Wait for config file to load before watching and prompting to restart

This commit is contained in:
Nathan Sobo
2019-05-17 04:31:52 -06:00
parent fb961df248
commit d5c84e5f4e

View File

@@ -271,17 +271,17 @@ class AtomApplication extends EventEmitter {
async launch (options) {
if (!this.configFilePromise) {
this.configFilePromise = this.configFile.watch()
this.configFilePromise = this.configFile.watch().then(disposable => {
this.disposable.add(disposable)
this.config.onDidChange('core.titleBar', () => this.promptForRestart())
this.config.onDidChange('core.colorProfile', () => this.promptForRestart())
})
// TodoElectronIssue: In electron v2 awaiting the watcher causes some delay
// in Windows machines, which affects directly the startup time.
if (process.platform === 'win32') {
this.configFilePromise.then(disposable => this.disposable.add(disposable))
} else {
this.disposable.add(await this.configFilePromise)
if (process.platform !== 'win32') {
await this.configFilePromise
}
this.config.onDidChange('core.titleBar', () => this.promptForRestart())
this.config.onDidChange('core.colorProfile', () => this.promptForRestart())
}
let optionsForWindowsToOpen = []