Skip to content

Commit c97d094

Browse files
fix(systeminformation): output right 'used node' version (from parent process) (#4141)
I noticed that in the System Information output, `used node` and `installed node` were always identical when starting via Electron. That usually shouldn't be the case. After digging into it, I found that since PR #4002, `used node` in the subprocess effectively reported the system Node version, not the parent process (which runs in Electron) version. This PR fixes that by passing `used node` from the parent process and logging it correctly. **Before:** `VERSIONS: electron: 41.3.0; used node: 26.0.0; installed node: 26.0.0; ...` **After:** `VERSIONS: electron: 41.3.0; used node: 24.15.0; installed node: 26.0.0; ...`
1 parent 461dbc0 commit c97d094

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

js/app.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,18 @@ global.version = require(`${global.root_path}/package.json`).version;
2424
global.mmTestMode = process.env.mmTestMode === "true";
2525
Log.log(`Starting MagicMirror: v${global.version}`);
2626

27-
// Log system information.
28-
Spawn("node ./js/systeminformation.js", { env: { ...process.env, ELECTRON_VERSION: `${process.versions.electron}` }, cwd: this.root_path, shell: true, detached: true, stdio: "inherit" });
27+
// Log system information in a subprocess so it is shown even on early startup failures.
28+
Spawn("node ./js/systeminformation.js", {
29+
env: {
30+
...process.env,
31+
ELECTRON_VERSION: `${process.versions.electron}`,
32+
USED_NODE_VERSION: `${process.versions.node}`
33+
},
34+
cwd: this.root_path,
35+
shell: true,
36+
detached: true,
37+
stdio: "inherit"
38+
});
2939

3040
if (process.env.MM_CONFIG_FILE) {
3141
global.configuration_file = process.env.MM_CONFIG_FILE.replace(`${global.root_path}/`, "");

js/systeminformation.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const logSystemInformation = async () => {
1010
const osInfo = await si.osInfo();
1111
const versions = await si.versions();
1212

13-
const usedNodeVersion = process.version.replace("v", "");
1413
const installedNodeVersion = versions.node;
1514
const totalRam = (os.totalmem() / 1024 / 1024).toFixed(2);
1615
const freeRam = (os.freemem() / 1024 / 1024).toFixed(2);
@@ -20,7 +19,7 @@ const logSystemInformation = async () => {
2019
"\n#### System Information ####",
2120
`- SYSTEM: manufacturer: ${system.manufacturer}; model: ${system.model}; virtual: ${system.virtual}; MM: v${mmVersion}`,
2221
`- OS: platform: ${osInfo.platform}; distro: ${osInfo.distro}; release: ${osInfo.release}; arch: ${osInfo.arch}; kernel: ${versions.kernel}`,
23-
`- VERSIONS: electron: ${process.env.ELECTRON_VERSION}; used node: ${usedNodeVersion}; installed node: ${installedNodeVersion}; npm: ${versions.npm}; pm2: ${versions.pm2}`,
22+
`- VERSIONS: electron: ${process.env.ELECTRON_VERSION}; used node: ${process.env.USED_NODE_VERSION}; installed node: ${installedNodeVersion}; npm: ${versions.npm}; pm2: ${versions.pm2}`,
2423
`- ENV: XDG_SESSION_TYPE: ${process.env.XDG_SESSION_TYPE}; MM_CONFIG_FILE: ${process.env.MM_CONFIG_FILE}`,
2524
` WAYLAND_DISPLAY: ${process.env.WAYLAND_DISPLAY}; DISPLAY: ${process.env.DISPLAY}; ELECTRON_ENABLE_GPU: ${process.env.ELECTRON_ENABLE_GPU}`,
2625
`- RAM: total: ${totalRam} MB; free: ${freeRam} MB; used: ${usedRam} MB`,

0 commit comments

Comments
 (0)