Skip to content

Stop silent updates from waiting on the "Failed to uninstall" dialog - #142

Draft
IliaMManolov wants to merge 1 commit into
mainfrom
ccr-324b73e0-ynx0j5-silent-uninstall-dialog
Draft

IliaMManolov wants to merge 1 commit into
mainfrom
ccr-324b73e0-ynx0j5-silent-uninstall-dialog

Conversation

@IliaMManolov

@IliaMManolov IliaMManolov commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Small installer fix, independent of the telemetry MVP in #141. For Ilia's review. Do not merge yet.

Summary

During an upgrade, the NSIS installer first runs the previous version's uninstaller. If that uninstaller fails, electron-builder shows "Failed to uninstall old application files. Please try running the installer again." This MessageBox has no /SD default, so it also appears in a silent install. A silent auto-update therefore waits on a dialog that the user did not start, and the update looks stuck until someone clicks OK.

build/installer.nsh now defines customUnInstallCheck and customUnInstallCheckCurrentUser. They reproduce electron-builder's default handling (handleUninstallResult in app-builder-lib 26.x) and add only /SD IDOK:

  • A silent run now fails at once with error level 2.
  • An interactive install still shows the dialog. /SD applies only to silent runs.
  • src/main/__tests__/nsisUninstallCheck.test.ts pins the upstream function. An electron-builder upgrade that changes it fails the test, so the copy gets reviewed.

Overlap with #141

#141 defines the same two macros to add telemetry. The second of the two PRs to merge gets a small conflict in installer.nsh. I will rebase #141 onto this fix when one of them merges.

Test plan

  • npm run typecheck, npx vitest run: 211 tests pass, 1 new (pin test).
  • Cross-built both installers on Linux (electron-builder + wine, -WX): unchanged main, and this branch.
  • Under wine, silent update (/S --updated) with the old Uninstall SealGate.exe replaced by a program that exits with code 1:
    • main: the dialog appears and the installer waits until it is killed. The harness stopped it after 60 s (exit 124).
    • this branch: no dialog. The installer exits with code 2 after 8.8 s.
  • A silent update with a working old uninstaller still succeeds (exit 0) on both builds.
  • Interactive install with a failing old uninstaller still shows the dialog. Under wine the run stops earlier, at the known wine "SealGate cannot be closed" artifact, so this needs a Windows VM.

Generated by Claude Code


Summary by cubic

Fixes silent auto-updates hanging when the previous version's uninstaller fails. The NSIS installer now defines customUnInstallCheck and customUnInstallCheckCurrentUser to reproduce electron-builder's default handling with /SD IDOK added, so a silent run fails at once with error level 2 instead of waiting on a dialog the user didn't start. Interactive installs still show the "Failed to uninstall" dialog. A new test pins the upstream handleUninstallResult so an electron-builder upgrade that changes it fails the test.

Written for commit 154722b. Summary will update on new commits.

View guided diff Turn on auto-fix

electron-builder shows "Failed to uninstall old application files" with a
MessageBox that has no /SD default, so the box also appears in a silent
install. When the previous version's uninstaller fails during an
auto-update, the update waits on that dialog and looks stuck.

customUnInstallCheck(CurrentUser) now reproduce electron-builder's default
handling with /SD IDOK added: a silent run fails at once with error level 2,
and interactive installs still show the dialog. A test pins the upstream
handleUninstallResult so an electron-builder upgrade that changes it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiFcRTVRzq2KVKYAgvKyNK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants