electron-builder
electron-builder copied to clipboard
`DebUpdater.quitAndInstall()` does not work if app has restarted
- Electron-Builder Version: 24.9.1
- Node Version: 20.11.0
- Electron Version: 22.3.3
- Electron Type (current, beta, nightly): current
- Target: deb
We are using the DebUpdater
to update our deb
target app. Clicking the button to update (triggers updater.quiteAndInstall()
without the app being restarted, works as expected by prompting for the user's password and then updating the app and restarting it. However, if we first restart the app (by calling app.relaunch()
followed by app.exit()
), and then click the button to update, the app simply closes and relaunches without prompting for the user's password and installing the update.
I think that's because you're overwriting the order of operations
DebUpdater already has logic to call app.relaunch()
, just need to set isForceRunAfter: true
https://github.com/electron-userland/electron-builder/blob/6fec9e810d6d28b8aa3fa411c0dc77a8ab8f4563/packages/electron-updater/src/DebUpdater.ts#L36-L38
The base updater also calls app.quit()
as well, so I don't think you need to be manually doing it yourself.
https://github.com/electron-userland/electron-builder/blob/6fec9e810d6d28b8aa3fa411c0dc77a8ab8f4563/packages/electron-updater/src/BaseUpdater.ts#L14-L27