Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(updater): keep the wizard when reg cannot answer, and test the dual-install handoff
EtienneLescotf7894518960b
diff --git a/electron/auto-updater.test.ts b/electron/auto-updater.test.tsindex 460699f4e..6dfa89e4c 100644--- a/electron/auto-updater.test.ts+++ b/electron/auto-updater.test.ts@@ -1,3 +1,4 @@+import { spawnSync } from "node:child_process";import fs from "node:fs";import { UUID } from "builder-util-runtime";import { beforeEach, describe, expect, it, vi } from "vitest";@@ -160,6 +161,19 @@ describe("self-update flow", () => {await installSelfUpdate();expect(mocks.autoUpdater.quitAndInstall).toHaveBeenCalledWith(true, true);});++ it("hands over to the wizard on Windows when both installs answer", async () => {+ const platform = Object.getOwnPropertyDescriptor(process, "platform");+ Object.defineProperty(process, "platform", { value: "win32" });+ vi.mocked(spawnSync).mockReturnValue({ status: 0 } as ReturnType<typeof spawnSync>);+ try {+ await installSelfUpdate();+ } finally {+ if (platform) Object.defineProperty(process, "platform", platform);+ vi.mocked(spawnSync).mockReturnValue({ status: 1 } as ReturnType<typeof spawnSync>);+ }+ expect(mocks.autoUpdater.quitAndInstall).toHaveBeenCalledWith(false, true);+ });});describe("installsSilently", () => {diff --git a/electron/auto-updater.ts b/electron/auto-updater.tsindex 14508063c..41c17584a 100644--- a/electron/auto-updater.ts+++ b/electron/auto-updater.ts@@ -90,7 +90,9 @@ export const NSIS_INSTALL_KEY = "Software\\5b412b41-8d8b-5faf-b557-de4fe681e5fc"function hasNsisInstall(hive: "HKLM" | "HKCU"): boolean {const key = `${hive}\\${NSIS_INSTALL_KEY}`;const args = ["query", key, "/v", "InstallLocation", "/reg:64"];- return spawnSync("reg", args, { windowsHide: true }).status === 0;+ // Exit 1 is reg's "key not found". Anything else, reg itself failing to run included, counts+ // as present, so a doubt keeps the wizard rather than risking the wrong copy.+ return spawnSync("reg", args, { windowsHide: true }).status !== 1;}/** Whether the installer can run with /S. Without it the assisted NSIS installer shows its whole