Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19354 from atom/ns/fix-restart-prompt
Browse files Browse the repository at this point in the history
Wait for config file to load before prompting to restart in config.onDidChange callback
  • Loading branch information
Nathan Sobo committed May 17, 2019
2 parents fb961df + d5c84e5 commit 9ced07e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main-process/atom-application.js
Expand Up @@ -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 = []
Expand Down

0 comments on commit 9ced07e

Please sign in to comment.