From 9bb480304a78823f19a17e763d7ddbe1994bc58c Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Wed, 20 May 2026 12:17:06 +0200 Subject: [PATCH] fix(updatenotification): use process.argv[0] as restart binary PR #4156 hardcoded `node` as the interpreter, causing a crash when restarting under Electron - `require("electron")` returns only a path string in plain Node, making `electron.app` undefined. Closes #4154 --- defaultmodules/updatenotification/update_helper.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/defaultmodules/updatenotification/update_helper.js b/defaultmodules/updatenotification/update_helper.js index dd92c4ffe1..095f241e00 100644 --- a/defaultmodules/updatenotification/update_helper.js +++ b/defaultmodules/updatenotification/update_helper.js @@ -136,10 +136,12 @@ class Updater { const out = process.stdout; const err = process.stderr; - // Get the current process command line - const currentCommand = process.argv.slice(1).join(" "); - const subprocess = Spawn(`node ${currentCommand}`, { cwd: this.root_path, shell: true, detached: true, stdio: ["ignore", out, err] }); - subprocess.unref(); // detach the newly launched process from the master process + // Restart with the same binary and arguments as the current process + const binary = process.argv[0]; + const args = process.argv.slice(1); + const options = { cwd: this.root_path, detached: true, stdio: ["ignore", out, err] }; + const subprocess = Spawn(binary, args, options); + subprocess.unref(); // allow the current process to exit without waiting for the subprocess process.exit(); }