fix(desktop): stop AppImage updates hanging on quit and deleting the app (#1485)

* fix(desktop): disable auto-install on quit for AppImage only

electron-updater's AppImageUpdater.doInstall() uses execFileSync with APPIMAGE_EXIT_AFTER_INSTALL when autoInstallOnAppQuit is true. For AppImages, this blocks the old process indefinitely because the new process has no installer step to exit from — the mv already completed the install.

Scoped to AppImage only (process.platform === 'linux' && process.env.APPIMAGE). .deb/.rpm/Windows/macOS keep auto-install-on-quit working as before.

* fix(desktop): keep AppImage filename stable across updates

electron-updater renames a versioned AppImage to a new path on update and
unlinks the old one. That orphaned the previous binary, broke desktop
shortcuts, and dangled the ~/.local/bin/paseo CLI symlink, which points at
$APPIMAGE. Dropping ${version} from the AppImage artifactName makes the
updater overwrite the file in place instead; deb/rpm keep versioned names.

Also documents why AppImage must not auto-install on quit (the blocking
execFileSync gated on APPIMAGE_EXIT_AFTER_INSTALL, honored only by
AppImageLauncher) and extracts that gate into a unit-tested helper.

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
xpufx
2026-06-17 10:09:35 +03:00
committed by GitHub
parent 14743fa0b0
commit 11abbcc630
3 changed files with 36 additions and 1 deletions

View File

@@ -19,8 +19,18 @@ import {
resolveStagingUserId,
rolloutManifestSchema,
shouldAdmitToRollout,
shouldAutoInstallOnQuit,
} from "./auto-updater";
describe("shouldAutoInstallOnQuit", () => {
it("auto-installs on quit everywhere except Linux AppImage", () => {
expect(shouldAutoInstallOnQuit({ platform: "linux", isAppImage: true })).toBe(false);
expect(shouldAutoInstallOnQuit({ platform: "linux", isAppImage: false })).toBe(true);
expect(shouldAutoInstallOnQuit({ platform: "darwin", isAppImage: false })).toBe(true);
expect(shouldAutoInstallOnQuit({ platform: "win32", isAppImage: false })).toBe(true);
});
});
describe("shouldAdmitToRollout", () => {
it("admits beta, missing rollout hours, zero-hour rollout, and missing release date", () => {
expect(

View File

@@ -76,13 +76,31 @@ export function getStagingUserId(): Promise<string> {
return cachedStagingUserIdPromise;
}
// AppImages have no install step. electron-updater "installs" by unlinking the
// running file and mv-ing the downloaded one into place; on app quit it does this
// via a *blocking* execFileSync(newAppImage, { APPIMAGE_EXIT_AFTER_INSTALL: "true" }).
// That env var is only honored by AppImageLauncher, so without it the freshly
// launched process boots the full app and never exits — the quit hangs forever,
// with the old binary already deleted. We therefore install AppImages only on
// explicit quitAndInstall (the "Update now" button), which takes the non-blocking
// spawn path. Every other target keeps auto-install-on-quit, which works there.
export function shouldAutoInstallOnQuit(input: {
platform: NodeJS.Platform;
isAppImage: boolean;
}): boolean {
return !(input.platform === "linux" && input.isAppImage);
}
class ElectronAppUpdateRuntime implements AppUpdateRuntime {
private configured = false;
configure(input: AppUpdateRuntimeConfiguration): void {
autoUpdater.autoDownload = true;
autoUpdater.autoInstallOnAppQuit = true;
autoUpdater.autoRunAppAfterInstall = true;
autoUpdater.autoInstallOnAppQuit = shouldAutoInstallOnQuit({
platform: process.platform,
isAppImage: Boolean(process.env.APPIMAGE),
});
autoUpdater.allowPrerelease = input.releaseChannel === "beta";
autoUpdater.channel = input.releaseChannel === "beta" ? "beta" : "latest";
autoUpdater.allowDowngrade = false;