diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 57cc82b30d..d3bc7f3997 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -949,6 +949,13 @@ function startBackend(): void { env: { ...process.env, ELECTRON_RUN_AS_NODE: "1", + // Clear env vars that the bootstrap pipe now delivers, so stray + // values inherited from the user's shell cannot override them. + T3CODE_MODE: undefined, + T3CODE_PORT: undefined, + T3CODE_HOME: undefined, + T3CODE_NO_BROWSER: undefined, + T3CODE_AUTH_TOKEN: undefined, }, stdio: captureBackendLogs ? ["ignore", "pipe", "pipe", "pipe"] diff --git a/apps/server/src/bootstrap.ts b/apps/server/src/bootstrap.ts index e744b9c502..345846651e 100644 --- a/apps/server/src/bootstrap.ts +++ b/apps/server/src/bootstrap.ts @@ -35,7 +35,11 @@ export const readBootstrapEnvelope = Effect.fn("readBootstrapEnvelope")(function if (!fdReady) return Option.none(); const streamFd = yield* Effect.try({ - try: () => NFS.openSync(resolveFdPath(fd), "r"), + try: () => { + const fdPath = resolveFdPath(fd); + if (fdPath === undefined) return fd; + return NFS.openSync(fdPath, "r"); + }, catch: (error) => new BootstrapError({ message: "Failed to duplicate bootstrap fd.", @@ -113,9 +117,12 @@ function isUnavailableBootstrapFdError(error: unknown): boolean { ); } -function resolveFdPath(fd: number): string { +function resolveFdPath(fd: number): string | undefined { if (process.platform === "linux") { return `/proc/self/fd/${fd}`; } + if (process.platform === "win32") { + return undefined; + } return `/dev/fd/${fd}`; }