Skip to content

Commit 9eb06ff

Browse files
fix(server): browser setup command names the running t3 executable, not another t3 on PATH
resolveHostCliCommand trusted any `t3` on PATH unless T3CODE_CLI_PATH pointed elsewhere, so a standalone executable started directly suggested another install's CLI. Compare PATH's `t3` against this install's launcher (the desktop shim or the running executable) and use the bare `t3` only when they are the same file. Fixes #22626 AI-assisted; verified with the tests and tools listed above.
1 parent 4e40101 commit 9eb06ff

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎apps/server/src/cli/invocation.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,16 @@ export const resolveHostCliCommand = Effect.fn("invocation.resolveHostCliCommand
155155
[prefix, ...args.map((arg) => hostShellWord(platform, arg))].join(" ");
156156
const command = yield* resolveCliCommand(subcommand);
157157
if (command !== `t3 ${subcommand}`) return { command: withArgs(command), launcher: false };
158+
const launcher = yield* resolveInstallLauncher;
159+
if (Option.isNone(launcher)) return { command: withArgs(command), launcher: false };
158160
const onPath = yield* resolveCommandPath("t3");
159161
if (onPath !== null) {
160-
const shim = (yield* HostProcess.Environment).T3CODE_CLI_PATH?.trim();
161162
const fs = yield* FileSystem.FileSystem;
162163
const real = (file: string) => fs.realPath(file).pipe(Effect.orElseSucceed(() => null));
163-
const shimReal = shim ? yield* real(shim) : null;
164-
if (shimReal === null || shimReal === (yield* real(onPath))) {
164+
if ((yield* real(onPath)) === ((yield* real(launcher.value)) ?? launcher.value)) {
165165
return { command: withArgs(command), launcher: false };
166166
}
167167
}
168-
const launcher = yield* resolveInstallLauncher;
169-
if (Option.isNone(launcher)) return { command: withArgs(command), launcher: false };
170168
// PowerShell runs a quoted path only through the call operator.
171169
const quoted = hostShellWord(platform, launcher.value);
172170
const call = platform === "win32" ? `& ${quoted}` : quoted;

0 commit comments

Comments
 (0)