Skip to content

Commit f61bf06

Browse files
fix(server): translate drive paths under WSL services started without WSL env
Servers started by systemd lack WSL_DISTRO_NAME and WSL_INTEROP, so the env gate skipped translation there. Try wslpath for any drive path on Linux; off WSL the spawn fails and the path is left as it was. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0121c71 commit f61bf06

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

‎apps/server/src/testUtils/fakeWsl.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const makeFakeWslHost = Effect.gen(function* () {
2727
const environment = {
2828
...HostProcess.Environment.defaultValue(),
2929
PATH: `${binDir}:${HostProcess.Environment.defaultValue().PATH ?? ""}`,
30-
WSL_DISTRO_NAME: "Ubuntu",
3130
};
3231
const underWsl = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
3332
effect.pipe(

‎apps/server/src/workspace/wslDrivePath.ts‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@ import * as ChildProcess from "effect/process/ChildProcess";
55
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
66

77
// WSL mounts Windows drives under a configurable automount root, so only wslpath knows where.
8-
// Untraced: it runs for every chip path, and only drive paths under WSL do any work.
8+
// No WSL env check: servers started by systemd lack WSL_DISTRO_NAME, and off WSL the spawn just fails.
9+
// Untraced: it runs for every chip path, and only drive paths on Linux do any work.
910
export const toWslDrivePath = Effect.fnUntraced(function* (requestedPath: string) {
1011
// spawn throws on a NUL byte instead of failing.
1112
if (!isWindowsDrivePath(requestedPath) || requestedPath.includes("\0")) return requestedPath;
12-
const env = yield* HostProcess.Environment;
13-
if (
14-
(yield* HostProcess.Platform) !== "linux" ||
15-
(env.WSL_DISTRO_NAME === undefined && env.WSL_INTEROP === undefined)
16-
) {
17-
return requestedPath;
18-
}
13+
if ((yield* HostProcess.Platform) !== "linux") return requestedPath;
1914
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
2015
const output = yield* spawner
2116
.string(
2217
ChildProcess.make("wslpath", ["-u", requestedPath], {
23-
env,
18+
env: yield* HostProcess.Environment,
2419
stdin: "ignore",
2520
stderr: "ignore",
2621
}),

0 commit comments

Comments
 (0)