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

Wait for config file to load before prompting to restart in config.onDidChange callback #19354

Merged
merged 1 commit into from May 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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