Skip to content

Commit

Permalink
fix: quitAndInstall not working on macOS with autoInstallOnAppQuit=fa…
Browse files Browse the repository at this point in the history
…lse (#6390)

* Fix quitAndInstall to work on macOS with autoInstallOnAppQuit=false

- 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.
  • Loading branch information
Nokel81 authored Nov 9, 2021
1 parent 5468c18 commit a5e8073
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/olive-weeks-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

Fix updating only on demand not working on macOS
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,10 +176,18 @@ 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
// Quit and install as soon as Squirrel get the update
this.nativeUpdater.on("update-downloaded", () => {
this.nativeUpdater.quitAndInstall()
})

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()
}
}
}
}

0 comments on commit a5e8073

Please sign in to comment.