Skip to content

Commit 4425f52

Browse files
fix(updatenotification): preserve start mode on restart (#4156)
Use current process arguments when spawning the restart command so auto-restart keeps the active runtime mode (for example `start:x11`) instead of always defaulting to `start`. This should fix #4154.
1 parent 41eb17c commit 4425f52

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

defaultmodules/updatenotification/update_helper.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,15 @@ class Updater {
130130
});
131131
}
132132

133-
// restart MagicMirror with "node --run start"
133+
// restart MagicMirror with the same start command as the current process
134134
nodeRestart () {
135135
Log.info("Restarting MagicMirror...");
136136
const out = process.stdout;
137137
const err = process.stderr;
138-
const subprocess = Spawn("node --run start", { cwd: this.root_path, shell: true, detached: true, stdio: ["ignore", out, err] });
138+
139+
// Get the current process command line
140+
const currentCommand = process.argv.slice(1).join(" ");
141+
const subprocess = Spawn(`node ${currentCommand}`, { cwd: this.root_path, shell: true, detached: true, stdio: ["ignore", out, err] });
139142
subprocess.unref(); // detach the newly launched process from the master process
140143
process.exit();
141144
}

0 commit comments

Comments
 (0)