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 21, 14:45 UTC
fix(shared): honor Windows PATHEXT regardless of key casing (#29376)
Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
luke committed
Nov 14, 2026 at 13:18 UTC
07885556d9e8e456c799cfff6636aa01bdd2b724
2 files changed
+25
-14
packages/shared/src/shell.test.ts
+20
-13
@@ -558,19 +558,26 @@ effectIt.layer(NodeServices.layer)("resolveCommandPath", (it) => {
558
const executable = path.join(cwd, "audit-command.cmd");
559
yield* fs.writeFileString(executable, "@echo off\n");
560
561
- const resolved = yield* resolveCommandPath(command, {
562
- env: { PATH: cwd, PATHEXT: ".CMD" },
563
- }).pipe(
564
- Effect.provideService(HostProcess.Platform, "win32"),
565
- Effect.provideService(CommandResolutionCache, new Map()),
566
- Effect.provideService(FileSystem.FileSystem, {
567
- ...fs,
568
- stat: (filePath) =>
569
- fs.stat(filePath === executable ? filePath : path.join(cwd, "missing")),
570
- }),
571
- );
572
-
573
- expect(resolved).toBe(executable);
561
+ const decoy = path.join(cwd, "audit-command.exe");
562
+ yield* fs.writeFileString(decoy, "");
563
+ for (const key of ["PATHEXT", "PathExt", "pathext"]) {
564
+ const resolved = yield* resolveCommandPath(command, {
565
+ env: { PATH: cwd, [key]: ".CMD" },
566
+ }).pipe(
567
+ Effect.provideService(HostProcess.Platform, "win32"),
568
+ Effect.provideService(CommandResolutionCache, new Map()),
569
+ Effect.provideService(FileSystem.FileSystem, {
570
+ ...fs,
571
+ stat: (filePath) =>
572
+ fs.stat(
573
+ filePath === executable || filePath === decoy
574
+ ? filePath
575
+ : path.join(cwd, "missing"),
576
+ ),
577
+ }),
578
+ );
579
+ expect(resolved).toBe(executable);
580
+ }
581
}),
582
);
583
packages/shared/src/shell.ts
+5
-1
@@ -492,7 +492,11 @@ function resolvePathEnvironmentVariable(env: NodeJS.ProcessEnv): string {
492
}
493
494
function resolveWindowsPathExtensions(env: NodeJS.ProcessEnv): ReadonlyArray<string> {
495
- const rawValue = env.PATHEXT;
495
+ const rawValue =
496
+ env.PATHEXT ??
497
+ Object.entries(env).find(
498
+ ([key, value]) => key.toUpperCase() === "PATHEXT" && value !== undefined,
499
+ )?.[1];
500
const fallback = [".COM", ".EXE", ".BAT", ".CMD"];
501
if (!rawValue) return fallback;
502