fix(updater): use app.quit() instead of app.exit(0) to allow installer launch#8
Draft
normal-coder wants to merge 3 commits into
Draft
fix(updater): use app.quit() instead of app.exit(0) to allow installer launch#8normal-coder wants to merge 3 commits into
normal-coder wants to merge 3 commits into
Conversation
…r launch fix lovstudio#7 Signed-off-by: 诺墨 <normal@normalcoder.com>
Signed-off-by: 诺墨 <normal@normalcoder.com>
Signed-off-by: 诺墨 <normal@normalcoder.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This Pull Request resolves the issue described in #7.
After downloading an update and clicking "Restart", the app exits but the installer never launches — the app restarts at
the same version.
Root cause: The before-quit handler unconditionally calls event.preventDefault(), blocking app.quit() from proceeding. The
shutdown flow in beginShutdown() then calls app.exit(0), which terminates the process immediately without firing the
will-quit event. Since electron-updater relies on will-quit to launch the installer (autoInstallOnAppQuit = true), the
update is downloaded but never applied.
Changes
src/main/index.tsbeginShutdown()) is not blocked and can trigger will-quit
src/renderer/lib/stores/update-store.tsFlow Before Fix
app.quit() → before-quit → event.preventDefault() → beginShutdown()
→ async cleanup → app.exit(0) → process dies → will-quit never fires
Flow After Fix
app.quit() → before-quit → event.preventDefault() → beginShutdown()
→ async cleanup → app.quit() (second call)
→ before-quit → shutdownStarted=true → return (no prevent)
→ will-quit fires → installer launches → update applied
Testing
pnpm run format✅pnpm run lint✅pnpm run typecheck✅pnpm run test✅ (945/945 tests pass; 5 unrelated env-specific failures)