Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions defaultmodules/updatenotification/update_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,15 @@ class Updater {
});
}

// restart MagicMirror with "node --run start"
// restart MagicMirror with the same start command as the current process
nodeRestart () {
Log.info("Restarting MagicMirror...");
const out = process.stdout;
const err = process.stderr;
const subprocess = Spawn("node --run start", { cwd: this.root_path, shell: true, detached: true, stdio: ["ignore", out, err] });

// 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
process.exit();
}
Expand Down