Skip to content

Commit 00596b3

Browse files
committed
fix(server): expand provider homes named in any case on Windows
Signed-off-by: Yordis Prieto <[email protected]>
1 parent 937916d commit 00596b3

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎apps/server/src/terminal/Manager.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,6 +1944,18 @@ it.layer(
19441944
}),
19451945
);
19461946

1947+
it.effect("expands a provider home named in any case on Windows", () =>
1948+
Effect.gen(function* () {
1949+
const path = yield* Path.Path;
1950+
const home = yield* HostProcess.HomeDirectory;
1951+
const { manager, ptyAdapter } = yield* createManager(5);
1952+
1953+
yield* manager.open(openInput({ env: { grok_home: "~/.grok-work" } }));
1954+
1955+
expect(ptyAdapter.spawnInputs[0]?.env.grok_home).toBe(path.join(home, ".grok-work"));
1956+
}).pipe(Effect.provide(layerWithHostPlatform("win32"))),
1957+
);
1958+
19471959
it.effect("fails closed when a provider instance is missing", () =>
19481960
Effect.gen(function* () {
19491961
const providerInstanceId = ProviderInstanceId.make("deleted_instance");

‎apps/server/src/terminal/Manager.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,11 @@ function createTerminalSpawnEnv(
13671367
platform === "win32"
13681368
? Object.keys(spawnEnv).find((candidate) => candidate.toLowerCase() === key.toLowerCase())
13691369
: undefined;
1370-
spawnEnv[existingKey ?? key] = expandHomeVariable(key, value, home);
1370+
spawnEnv[existingKey ?? key] = expandHomeVariable(
1371+
platform === "win32" ? key.toUpperCase() : key,
1372+
value,
1373+
home,
1374+
);
13711375
}
13721376
}
13731377
if (!spawnEnv.COLORTERM && runtimeEnv?.COLORTERM === undefined) {

0 commit comments

Comments
 (0)