fix: truly detach Windows update batch via spawn+unref instead of exec
All checks were successful
Build & Release / build (push) Successful in 2m26s
All checks were successful
Build & Release / build (push) Successful in 2m26s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fa4c4db944
commit
213d1d3039
1 changed files with 8 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { Notification, app, ipcMain } from "electron";
|
import { Notification, app, ipcMain } from "electron";
|
||||||
import { exec } from "child_process";
|
import { exec, spawn } from "child_process";
|
||||||
import { createWriteStream, mkdirSync, writeFileSync } from "fs";
|
import { createWriteStream, mkdirSync, writeFileSync } from "fs";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
import { tmpdir } from "os";
|
import { tmpdir } from "os";
|
||||||
|
|
@ -118,8 +118,13 @@ async function downloadAndInstall(url: string, version: string) {
|
||||||
].join("\r\n");
|
].join("\r\n");
|
||||||
writeFileSync(batchPath, bat);
|
writeFileSync(batchPath, bat);
|
||||||
|
|
||||||
// Launch batch detached so it outlives this process
|
// Spawn batch truly detached so it outlives this process
|
||||||
exec(`cmd /C start /B "" "${batchPath}"`);
|
const child = spawn("cmd.exe", ["/C", batchPath], {
|
||||||
|
detached: true,
|
||||||
|
stdio: "ignore",
|
||||||
|
windowsHide: false,
|
||||||
|
});
|
||||||
|
child.unref();
|
||||||
setUpdateReady(version); // restart button will just app.exit(0) — batch relaunches
|
setUpdateReady(version); // restart button will just app.exit(0) — batch relaunches
|
||||||
} else {
|
} else {
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue