Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(device): run desktop agent-device shims in Node mode #13093

Closedyashranaway(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/13093/headopened View on GitHub

Showing 2 changed files with 64 additions and 3 deletions.

x
0 of 2 viewed, 2 left
3 additions and 3 deletionsapps/server/src/device/AgentDeviceShim.tsModified
View file
@@ -35,7 +35,7 @@
console.error("Call device_open first and include its --config and --session flags.");
process.exit(1);
-const env = { ...process.env };
+const env = { ...process.env, ELECTRON_RUN_AS_NODE: "1" };
delete env.AGENT_DEVICE_DAEMON_BASE_URL;
delete env.AGENT_DEVICE_DAEMON_AUTH_TOKEN;
delete env.AGENT_DEVICE_CONFIG;
@@ -45,13 +45,13 @@
`,
);
if (platform === "win32") {
- const script = `@echo off\r\n"${node}" "${launcherPath}" %*\r\n`;
+ const script = `@echo off\r\nsetlocal\r\nset "ELECTRON_RUN_AS_NODE=1"\r\n"${node}" "${launcherPath}" %*\r\n`;
yield* fs.writeFileString(path.join(shimDir, "agent-device.cmd"), script);
} else {
const command = [node, launcherPath]
.map((value) => "'" + value.replaceAll("'", "'\"'\"'") + "'")
.join(" ");
- const script = `#!/bin/sh\nexec ${command} "$@"\n`;
+ const script = `#!/bin/sh\nexport ELECTRON_RUN_AS_NODE=1\nexec ${command} "$@"\n`;
const shimPath = path.join(shimDir, "agent-device");
yield* fs.writeFileString(shimPath, script);
yield* fs.chmod(shimPath, 0o755);
61 additions and 0 deletionsapps/server/src/device/AgentDeviceTarget.test.tsModified
View file