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 71d3704 commit 4192c1d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/electron-updater/src/MacUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ export class MacUpdater extends AppUpdater {
// Update already fetched by Squirrel, it's ready to install
this.nativeUpdater.quitAndInstall()
} else {
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 4192c1d

Please sign in to comment.