Skip to content

Commit 1907a0c

Browse files
committed
Fix packaged worker execution
1 parent 8758ebc commit 1907a0c

5 files changed

Lines changed: 26 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 1.0.4 - 2026-04-19
4+
5+
### Fixed
6+
7+
- Fixed packaged desktop benchmark/stress workers launching as a second RigScope app instead of Node by setting `ELECTRON_RUN_AS_NODE=1`.
8+
- Benchmark worker JSON parsing now reports a controlled API error instead of crashing the Electron main process on empty or invalid output.
9+
310
## 1.0.3 - 2026-04-19
411

512
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</p>
1212

1313
<p align="center">
14-
<a href="https://github.com/FaulMit/rigscope/releases/latest"><img alt="Latest release" src="https://img.shields.io/badge/release-v1.0.3-54d6ff?style=for-the-badge"></a>
14+
<a href="https://github.com/FaulMit/rigscope/releases/latest"><img alt="Latest release" src="https://img.shields.io/badge/release-v1.0.4-54d6ff?style=for-the-badge"></a>
1515
<a href="https://github.com/FaulMit/rigscope/actions/workflows/release.yml"><img alt="Release builds" src="https://img.shields.io/badge/builds-passing-8dff9f?style=for-the-badge"></a>
1616
<img alt="Platforms" src="https://img.shields.io/badge/Windows%20%7C%20Linux%20%7C%20macOS-111?style=for-the-badge">
1717
<img alt="Local first" src="https://img.shields.io/badge/local--first-127.0.0.1-54d6ff?style=for-the-badge">

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rigscope",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"private": true,
55
"description": "Cross-platform local hardware inventory, diagnostics, benchmark, and stress-test dashboard.",
66
"main": "electron/main.js",

server.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,13 +1028,23 @@ function runNodeBenchmark(script, timeout) {
10281028
execFile(process.execPath, ["-e", script], {
10291029
windowsHide: true,
10301030
timeout,
1031-
maxBuffer: 1024 * 256
1031+
maxBuffer: 1024 * 256,
1032+
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" }
10321033
}, (error, stdout, stderr) => {
10331034
if (error) {
10341035
reject(new Error(`${error.message}\n${stderr || ""}`));
10351036
return;
10361037
}
1037-
resolve(JSON.parse(stdout.trim()));
1038+
const output = stdout.trim();
1039+
if (!output) {
1040+
reject(new Error(`Benchmark worker produced no JSON output.${stderr ? `\n${stderr}` : ""}`));
1041+
return;
1042+
}
1043+
try {
1044+
resolve(JSON.parse(output));
1045+
} catch (parseError) {
1046+
reject(new Error(`Benchmark worker returned invalid JSON: ${parseError.message}\n${output.slice(0, 500)}`));
1047+
}
10381048
});
10391049
});
10401050
}
@@ -1109,7 +1119,8 @@ function startCpuStress({ durationSec = 60, workers } = {}) {
11091119
cpuStress.workers = Array.from({ length: workerCount }, () => {
11101120
const child = spawn(process.execPath, ["-e", cpuStressChildScript], {
11111121
windowsHide: true,
1112-
stdio: ["ignore", "pipe", "ignore", "ipc"]
1122+
stdio: ["ignore", "pipe", "ignore", "ipc"],
1123+
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" }
11131124
});
11141125
child.stdout.setEncoding("utf8");
11151126
child.stdout.on("data", (chunk) => {
@@ -1184,7 +1195,7 @@ function startMemoryStress({ durationSec = 60, targetMb } = {}) {
11841195
const child = spawn(process.execPath, ["-e", memoryStressChildScript], {
11851196
windowsHide: true,
11861197
stdio: ["ignore", "pipe", "ignore", "ipc"],
1187-
env: { ...process.env, RIGSCOPE_MEMORY_MB: String(capped) }
1198+
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1", RIGSCOPE_MEMORY_MB: String(capped) }
11881199
});
11891200
memoryStress.child = child;
11901201
child.stdout.setEncoding("utf8");

0 commit comments

Comments
 (0)