Skip to content

Commit

Permalink
Fix quitAndInstall not working on macOS with autoInstallOnAppQuit=false
Browse files Browse the repository at this point in the history
- Would never call nativeUpdater.checkForUpdates() if not installing on
  quit. Thus neither squirrelDownloadedUpdate was true nor the
  nativeUpdater's event "update-downloaded" be emitted. Leading to
  nothing happening.

- This commit fixes it by calling the checkForUpdates() in
  MacUpdater.quitAndInstall() when necessary

Signed-off-by: Sebastian Malton <sebastian@malton.name>
  • Loading branch information
Nokel81 committed Nov 3, 2021
1 parent d2ae0d3 commit 194c286
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/electron-updater/src/MacUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,15 @@ export class MacUpdater extends AppUpdater {
// update already fetched by Squirrel, it's ready to install
this.nativeUpdater.quitAndInstall()
} else {
// quit and install as soon as Squirrel get the update
if (!this.autoInstallOnAppQuit) {
/**
* If this was not `true` previously then MacUpdater.doDownloadUpdate()
* would not actually initiate the downloading by electron's autoUpdater
*/
this.nativeUpdater.checkForUpdates();
}

// Quit and install as soon as Squirrel get the update
this.nativeUpdater.on("update-downloaded", () => {
this.nativeUpdater.quitAndInstall()
})
Expand Down

0 comments on commit 194c286

Please sign in to comment.