Skip to content

Commit c3195aa

Browse files
committed
Spawn installer without powershell
1 parent fd1c01d commit c3195aa

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

public/electron/updateManager.js

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -218,36 +218,23 @@ const downloadAndUnzipFrontendMac = async (tag = undefined) => {
218218
};
219219

220220
/**
221-
* Spawn a PowerShell process to launch the InnoSetup installer executable, which contains the frontend and backend
221+
* Spawn a process to launch the InnoSetup installer executable, which contains the frontend and backend
222222
* upon confirmation from the user, the installer will be launched & Electron will exit
223223
* @returns {Promise<boolean>} true if the installer executable was launched successfully, false otherwise
224224
*/
225225
const spawnScriptToLaunchInstaller = () => {
226-
227-
const shellScript = `Start-Process -FilePath "${installerExePath}"`;
228-
229-
return new Promise((resolve, reject) => {
230-
const ps = spawn("powershell.exe", ["-Command", shellScript]);
231-
currentChildProcess = ps;
232-
233-
ps.stdout.on("data", (data) => {
234-
console.log(data.toString());
235-
});
236-
237-
ps.stderr.on("data", (data) => {
238-
currentChildProcess = null;
239-
console.error(data.toString());
240-
});
241-
242-
ps.on("exit", (code) => {
243-
currentChildProcess = null;
244-
if (code === 0) {
245-
resolve(true);
246-
} else {
247-
resolve(false);
248-
}
226+
try {
227+
// Launch the installer executable directly without waiting for it to finish
228+
const child = spawn(installerExePath, [], {
229+
detached: true,
230+
stdio: "ignore"
249231
});
250-
});
232+
child.unref();
233+
return true;
234+
} catch (e) {
235+
consoleLogger.error(`Failed to launch installer: ${e.message}`);
236+
return false;
237+
}
251238
};
252239

253240

0 commit comments

Comments
 (0)