Skip to content

Commit 5a02af1

Browse files
t3dotggclaude
andcommitted
fix(cli): t3 install sees a PATH entry with a trailing slash
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0679a69 commit 5a02af1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎apps/server/src/cli/install.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ it.layer(NodeServices.layer)("t3 install", (it) => {
6666
yield* fs.symlink(path.join(root, ".t3"), alias);
6767
yield* fs.remove(link);
6868
yield* fs.symlink(path.join(alias, "runtime/versions", VERSION, "t3"), link);
69-
yield* provide(installCli());
69+
const onPath = yield* provide(installCli(), { PATH: `/usr/bin:${path.join(root, "bin")}/` });
70+
assert.isTrue(onPath.onPath);
7071
const recorded = yield* fs.readFileString(path.join(runtimeDir, "launchers"));
7172
assert.equal(recorded, `${yield* fs.realPath(path.join(root, "bin"))}/t3\n`);
7273

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ export const installCli = Effect.fn("cli.install.install")(function* () {
106106
yield* fs.writeFileString(launchersFile, `${recorded}\n`, { flag: "a" }).pipe(Effect.ignore);
107107
}
108108

109-
const same = (entry: string) =>
110-
windows ? entry.toLowerCase() === binDir.toLowerCase() : entry === binDir;
109+
// resolve() drops trailing separators, so `~/.local/bin/` on PATH still matches.
110+
const normalize = (value: string) =>
111+
windows ? path.resolve(value).toLowerCase() : path.resolve(value);
112+
const same = (entry: string) => entry !== "" && normalize(entry) === normalize(binDir);
111113
const onPath = (environment.PATH ?? environment.Path ?? "").split(windows ? ";" : ":").some(same);
112114
return {
113115
link,

0 commit comments

Comments
 (0)