From d5c84e5f4eef248d1239ab16363389314a81f6ec Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 17 May 2019 04:31:52 -0600 Subject: [PATCH] Wait for config file to load before watching and prompting to restart --- src/main-process/atom-application.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index 8a7be9c84..e74a3d463 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -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 = []