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 23, 01:45 UTC
fix(shell): avoid interactive job control in environment probes (#11275)
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Louis Deconinck committed
Oct 19, 2026 at 20:21 UTC
7f63b10275103541660c1269c72234a16192f898
2 files changed
+16
-2
packages/shared/src/shell.test.ts
+6
-1
@@ -87,7 +87,12 @@ describe("readEnvironmentFromLoginShell probe", () => {
87
expect(args?.[1]).toContain("printenv PATH || true");
88
expect(args?.[1]).toContain("__T3CODE_ENV_PATH_START__");
89
expect(args?.[1]).toContain("__T3CODE_ENV_PATH_END__");
90
- expect(options).toEqual({ encoding: "utf8", timeout: 5000 });
90
+ expect(options).toEqual({
91
+ encoding: "utf8",
92
+ timeout: 5000,
93
+ detached: true,
94
+ stdio: ["ignore", "pipe", "ignore"],
95
+ });
96
});
97
});
98
packages/shared/src/shell.ts
+10
-1
@@ -20,7 +20,12 @@ const WINDOWS_SHELL_CANDIDATES = ["pwsh.exe", "powershell.exe"] as const;
20
type ExecFileSyncLike = (
21
file: string,
22
args: ReadonlyArray<string>,
23
- options: { encoding: "utf8"; timeout: number },
23
+ options: {
24
+ encoding: "utf8";
25
+ timeout: number;
26
+ detached?: true;
27
+ stdio?: ["ignore", "pipe", "ignore"];
28
+ },
29
) => string;
30
31
function canExecuteFile(filePath: string): boolean {
@@ -268,9 +273,13 @@ export const readEnvironmentFromLoginShell: ShellEnvironmentReader = (
273
return {};
274
}
275
276
+ // Interactive startup loads PATH entries; detaching prevents job control on an
277
+ // inherited controlling TTY from stopping the probe while the parent waits.
278
const output = execFile(shell, ["-ilc", buildEnvironmentCaptureCommand(names)], {
279
encoding: "utf8",
280
timeout: 5000,
281
+ detached: true,
282
+ stdio: ["ignore", "pipe", "ignore"],
283
});
284
285
const environment: Partial<Record<string, string>> = {};