@devries-cameron20 / t3code Mirror · read-only / commits / 300f7fd11d
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 05:00 UTC

[codex] Avoid shell for system executables (#2950)

Co-authored-by: Julius Marminge <julius@mac.lan>

Julius Marminge committed Jun 4, 2026 at 15:25 UTC 300f7fd11d61704617119634a99563e16c0e6913
8 files changed +10 -23
apps/server/src/diagnostics/ProcessDiagnostics.ts
-1
@@ -280,7 +280,6 @@ const runProcess = Effect.fn("runProcess")(
280 const child = yield* spawner.spawn(
281 ChildProcess.make(input.command, input.args, {
282 cwd: process.cwd(),
283 - shell: process.platform === "win32",
283 }),
284 );
285 const [stdout, stderr, exitCode] = yield* Effect.all(
apps/server/src/environment/Layers/ServerEnvironmentLabel.ts
-1
@@ -59,7 +59,6 @@ const runFriendlyLabelCommand = Effect.fn("runFriendlyLabelCommand")(function* (
59 command,
60 args,
61 timeoutBehavior: "timedOutResult",
62 - shell: process.platform === "win32",
62 })
63 .pipe(Effect.option);
64
apps/server/src/project/Layers/RepositoryIdentityResolver.test.ts
-1
@@ -23,7 +23,6 @@ const git = (cwd: string, args: ReadonlyArray<string>) =>
23 return yield* processRunner.run({
24 command: "git",
25 args: ["-C", cwd, ...args],
26 - shell: process.platform === "win32",
26 });
27 }).pipe(Effect.provide(ProcessRunner.layer));
28
apps/server/src/project/Layers/RepositoryIdentityResolver.ts
-2
@@ -94,7 +94,6 @@ const resolveRepositoryIdentityCacheKey = Effect.fn("resolveRepositoryIdentityCa
94 command: "git",
95 args: ["-C", cwd, "rev-parse", "--show-toplevel"],
96 timeoutBehavior: "timedOutResult",
97 - shell: process.platform === "win32",
97 })
98 .pipe(Effect.option);
99 if (topLevelResult._tag === "None" || topLevelResult.value.code !== 0) {
@@ -119,7 +118,6 @@ const resolveRepositoryIdentityFromCacheKey = Effect.fn("resolveRepositoryIdenti
118 command: "git",
119 args: ["-C", cacheKey, "remote", "-v"],
120 timeoutBehavior: "timedOutResult",
122 - shell: process.platform === "win32",
121 })
122 .pipe(Effect.option);
123 if (remoteResult._tag === "None" || remoteResult.value.code !== 0) {
apps/server/src/terminal/Layers/Manager.ts
-1
@@ -519,7 +519,6 @@ function windowsInspectSubprocess(
519 timeout: "1500 millis",
520 maxOutputBytes: 32_768,
521 outputMode: "truncate",
522 - shell: process.platform === "win32",
522 timeoutBehavior: "timedOutResult",
523 });
524 }).pipe(
packages/ssh/src/command.ts
+4 -4
@@ -16,6 +16,7 @@ import { SshCommandError, SshInvalidTargetError } from "./errors.ts";
16 const PUBLISHABLE_T3_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u;
17 const DEFAULT_SSH_COMMAND_TIMEOUT_MS = 60_000;
18 const MAX_SSH_ERROR_OUTPUT_LENGTH = 4_000;
19 +export const SSH_COMMAND = process.platform === "win32" ? "ssh.exe" : "ssh";
20
21 const encoder = new TextEncoder();
22
@@ -192,15 +193,14 @@ const runSshCommandInScope = Effect.fn("ssh/command.runSshCommand.inScope")(func
193 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
194 yield* Effect.logDebug("ssh.command.start", {
195 ...sshTargetLogFields(target),
195 - command: ["ssh", ...args],
196 + command: [SSH_COMMAND, ...args],
197 hasStdin: input.stdin !== undefined,
198 timeoutMs: input.timeoutMs ?? DEFAULT_SSH_COMMAND_TIMEOUT_MS,
199 });
200 const child = yield* spawner
201 .spawn(
201 - ChildProcess.make("ssh", args, {
202 + ChildProcess.make(SSH_COMMAND, args, {
203 env: environment,
203 - shell: process.platform === "win32",
204 stdin: {
205 stream: stdinStream(input.stdin),
206 endOnDone: true,
@@ -212,7 +212,7 @@ const runSshCommandInScope = Effect.fn("ssh/command.runSshCommand.inScope")(func
212 Effect.mapError(
213 (cause) =>
214 new SshCommandError({
215 - command: ["ssh", ...args],
215 + command: [SSH_COMMAND, ...args],
216 exitCode: null,
217 stderr: "",
218 message:
packages/ssh/src/tunnel.ts
+3 -3
@@ -36,6 +36,7 @@ import {
36 remoteStateKey,
37 resolveSshTarget,
38 runSshCommand,
39 + SSH_COMMAND,
40 targetConnectionKey,
41 } from "./command.ts";
42 import {
@@ -1068,7 +1069,7 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input:
1069 `${input.localPort}:127.0.0.1:${input.remotePort}`,
1070 hostSpec,
1071 ];
1071 - const tunnelCommand = ["ssh", ...args];
1072 + const tunnelCommand = [SSH_COMMAND, ...args];
1073 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
1074 const scope = yield* Scope.Scope;
1075 yield* Effect.logDebug("ssh.tunnel.spawn.start", {
@@ -1081,9 +1082,8 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input:
1082 });
1083 const child = yield* spawner
1084 .spawn(
1084 - ChildProcess.make("ssh", args, {
1085 + ChildProcess.make(SSH_COMMAND, args, {
1086 env: childEnvironment,
1086 - shell: process.platform === "win32",
1087 stdin: {
1088 stream: Stream.empty,
1089 endOnDone: true,
packages/tailscale/src/tailscale.ts
+3 -10
@@ -10,6 +10,7 @@ export const DEFAULT_TAILSCALE_SERVE_PORT = 443;
10 export const TAILSCALE_STATUS_TIMEOUT_MS = 1_500;
11 export const TAILSCALE_SERVE_TIMEOUT_MS = 10_000;
12 export const TAILSCALE_PROBE_TIMEOUT_MS = 2_500;
13 +const TAILSCALE_COMMAND = process.platform === "win32" ? "tailscale.exe" : "tailscale";
14
15 export class TailscaleCommandError extends Data.TaggedError("TailscaleCommandError")<{
16 readonly command: readonly string[];
@@ -136,11 +137,7 @@ export const readTailscaleStatus: Effect.Effect<
137 const args = ["status", "--json"];
138 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
139 const child = yield* spawner
139 - .spawn(
140 - ChildProcess.make("tailscale", args, {
141 - shell: process.platform === "win32",
142 - }),
143 - )
140 + .spawn(ChildProcess.make(TAILSCALE_COMMAND, args))
141 .pipe(
142 Effect.mapError((cause) =>
143 tailscaleCommandError(
@@ -215,11 +212,7 @@ const runTailscaleCommand = (
212 Effect.gen(function* () {
213 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
214 const child = yield* spawner
218 - .spawn(
219 - ChildProcess.make("tailscale", args, {
220 - shell: process.platform === "win32",
221 - }),
222 - )
215 + .spawn(ChildProcess.make(TAILSCALE_COMMAND, args))
216 .pipe(
217 Effect.mapError((cause) =>
218 tailscaleCommandError(