Skip to content

Commit 2b714e3

Browse files
committed
fix systeminformation thread not ending
1 parent 13d51cf commit 2b714e3

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

js/app.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require("./alias-resolver");
33

44
const fs = require("node:fs");
55
const path = require("node:path");
6-
const Spawn = require("node:child_process").spawn;
6+
const { Worker } = require("node:worker_threads");
77
const Log = require("logger");
88

99
// global absolute root path
@@ -25,16 +25,16 @@ global.mmTestMode = process.env.mmTestMode === "true";
2525
Log.log(`Starting MagicMirror: v${global.version}`);
2626

2727
// Log system information in a subprocess so it is shown even on early startup failures.
28-
Spawn("node ./js/systeminformation.js", {
28+
const worker = new Worker(`${global.root_path}/js/systeminformation.js`, {
2929
env: {
3030
...process.env,
3131
ELECTRON_VERSION: `${process.versions.electron}`,
3232
USED_NODE_VERSION: `${process.versions.node}`
33-
},
34-
cwd: this.root_path,
35-
shell: true,
36-
detached: true,
37-
stdio: "inherit"
33+
}
34+
});
35+
36+
worker.on("error", (err) => {
37+
Log.error("Systeminformation error:", err);
3838
});
3939

4040
if (process.env.MM_CONFIG_FILE) {

0 commit comments

Comments
 (0)