Files
dsh-desktop/patches/dsh-subprocess-local@0.1.5-rc.2.patch
AdamPlatin123 da745d924a fix(desktop): scope the runner Node-mode flag to tool subprocesses on every platform
The upstream runner only set ELECTRON_RUN_AS_NODE on its Windows path,
so a Linux Electron host spawned tool runners as full applications that
died inside their launch scope — bash, glob, and grep all failed in
packaged sessions. A yarn patch: resolution applies the flag for every
Electron host at exactly the runner-child environment, replacing the
earlier whole-process export (which would have turned every Chromium
child — renderer, GPU, network service — into a dying Node process).
The packaging chain carries the patched package into both artifacts;
packaged-runtime and package-surface tests are updated to pin it.
2026-09-20 02:36:16 +08:00

19 lines
840 B
Diff

diff --git a/lib/runner-launch-COYGu0Dl.js b/lib/runner-launch-COYGu0Dl.js
--- a/lib/runner-launch-COYGu0Dl.js
+++ b/lib/runner-launch-COYGu0Dl.js
@@ -1449,6 +1449,14 @@
const normalized = name.toUpperCase();
if (RUNNER_CONTROL_ENV_PREFIXES.some((prefix) => normalized.startsWith(prefix))) Reflect.deleteProperty(env, name);
}
+ // Electron hosts must start the private runner in Node mode on every
+ // platform; target env arrives over IPC, so never add this flag to it.
+ if (process.versions.electron !== void 0 && (process.platform !== "win32" || selection === WINDOWS_RUNNER_SELECTION)) {
+ for (const name of Object.keys(env)) {
+ if (name.toUpperCase() === "ELECTRON_RUN_AS_NODE") Reflect.deleteProperty(env, name);
+ }
+ env.ELECTRON_RUN_AS_NODE = "1";
+ }
return {
...env,
[SUBPROCESS_RUNNER_ENV]: selection,