Skip to content

Commit 4ee67df

Browse files
committed
fix(updater): add delayed relaunch fallback after install
Schedule a detached delayed app relaunch before invoking interactive quitAndInstall so users are brought back into the updated app even when NSIS does not auto-run on some Windows machines. Made-with: Cursor
1 parent c6d920f commit 4ee67df

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

app/app/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function Index() {
6363
Hyperlinks Space App
6464
</Text>
6565
<Text style={{ textAlign: "center", marginBottom: 12 }}>
66-
Outside Telegram, authentication abandoned.
66+
Outside TMA, authentication abandoned.
6767
</Text>
6868
<View style={{ marginTop: 8, padding: 8, backgroundColor: "#f0f0f0", borderRadius: 8, alignSelf: "stretch" }}>
6969
<Text style={{ fontSize: 12, fontWeight: "600" }}>Debug</Text>

app/windows/build.cjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { app, BrowserWindow, Menu, protocol, net, dialog, Notification } = require("electron");
2+
const { spawn } = require("child_process");
23
const path = require("path");
34
const fs = require("fs");
45
const { pathToFileURL } = require("url");
@@ -53,6 +54,23 @@ function setupAutoUpdater() {
5354

5455
let installRequested = false;
5556

57+
function scheduleRelaunchFallback() {
58+
try {
59+
const exePath = app.getPath("exe");
60+
// Interactive installer may not relaunch on some machines; schedule a delayed reopen.
61+
const relaunchCmd = `ping 127.0.0.1 -n 26 > nul && start "" "${exePath}"`;
62+
const child = spawn(process.env.ComSpec || "cmd.exe", ["/c", relaunchCmd], {
63+
detached: true,
64+
stdio: "ignore",
65+
windowsHide: true,
66+
});
67+
child.unref();
68+
log("[updater] scheduled relaunch fallback");
69+
} catch (e) {
70+
log(`[updater] relaunch fallback schedule failed: ${e?.message || e}`);
71+
}
72+
}
73+
5674
const requestInstallNow = () => {
5775
installRequested = true;
5876
log("[updater] user accepted update install");
@@ -67,6 +85,7 @@ function setupAutoUpdater() {
6785

6886
try {
6987
// Interactive mode shows NSIS progress/update UI to the user.
88+
scheduleRelaunchFallback();
7089
autoUpdater.quitAndInstall(false, false);
7190
} catch (e) {
7291
log(`quitAndInstall failed: ${e?.message || e}`);

0 commit comments

Comments
 (0)