Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): the suggested t3 command names this install, not another t3 on PATH #22639

MergedGourav224(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/22639/headmerged by maria-rcks View on GitHub

Showing 2 changed files with 20 additions and 3 deletions.

x
0 of 2 viewed, 2 left
8 additions and 0 deletionsapps/server/src/cli/invocation.test.tsModified
View file
@@ -71,7 +71,15 @@
​
expect(yield* rootCommand(desktop)).toBe(`sudo '${shim}' browser setup`);
​
+ // An unrelated `t3` on PATH, such as an older npm global, is another install's CLI.
expect(yield* rootCommand({ ...desktop, path: yield* pathWithT3 })).toBe(
+ `sudo '${shim}' browser setup`,
+ );
+​
+ // The link the app installs onto PATH leads to its own launcher, so plain `t3` is right.
+ const linked = yield* fs.makeTempDirectoryScoped();
+ yield* fs.symlink(shim, path.join(linked, "t3"));
+ expect(yield* rootCommand({ ...desktop, path: linked })).toBe(
'sudo env "PATH=$PATH" t3 browser setup',
);
​
12 additions and 3 deletionsapps/server/src/cli/invocation.tsModified
View file
@@ -6,7 +6,7 @@
​
import type { ServerInstallation } from "@t3tools/contracts";
import * as HostProcess from "@t3tools/shared/HostProcess";
-import { isCommandAvailable } from "@t3tools/shared/shell";
+import { resolveCommandPath } from "@t3tools/shared/shell";
​
import packageJson from "../../package.json" with { type: "json" };
​