GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): browser setup command names the running t3 executable, n… · pingdotgg/t3code@b63b559

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/cli
    • invocation.test.ts
    • invocation.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/cli/invocation.test.ts
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,37 @@ it.layer(NodeServices.layer)("root CLI commands", (it) => {
109109
}),
110110
).toBe("sudo /opt/t3/t3 browser setup");
111111

112+
// A standalone executable started directly (systemd, no launcher) is still this install.
113+
expect(
114+
yield* rootCommand({
115+
node: "/opt/t3/t3",
116+
entry: "/opt/t3/t3",
117+
executable: true,
118+
path: yield* pathWithT3,
119+
}),
120+
).toBe("sudo /opt/t3/t3 browser setup");
121+
122+
// A global npm launcher runs the downloaded executable; PATH's `t3` is that launcher.
123+
const prefix = path.join(home, "npm");
124+
const npmLauncher = path.join(prefix, "lib/node_modules/t3/bin/t3.mjs");
125+
yield* fs.makeDirectory(path.dirname(npmLauncher), { recursive: true });
126+
yield* fs.makeDirectory(path.join(prefix, "bin"));
127+
yield* fs.writeFileString(npmLauncher, "", { mode: 0o755 });
128+
yield* fs.writeFileString(
129+
path.join(prefix, "lib/node_modules/t3/package.json"),
130+
`{"name":"t3","version":"${packageJson.version}"}`,
131+
);
132+
yield* fs.symlink(npmLauncher, path.join(prefix, "bin/t3"));
133+
expect(
134+
yield* rootCommand({
135+
node: "/home/theo/.t3/runtime/versions/1.0.0/t3",
136+
entry: "/home/theo/.t3/runtime/versions/1.0.0/t3",
137+
executable: true,
138+
path: path.join(prefix, "bin"),
139+
env: { T3CODE_NPM_LAUNCHER_PATH: npmLauncher },
140+
}),
141+
).toBe('sudo env "PATH=$PATH" t3 browser setup');
142+
112143
expect(
113144
yield* rootCommand({ ...desktop, env: { T3CODE_CLI_PATH: path.join(home, "gone") } }),
114145
).toBe('sudo env "PATH=$PATH" t3 browser setup');
Collapse file

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

Copy file name to clipboardExpand all lines: apps/server/src/cli/invocation.ts
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,17 @@ export const resolveHostCliCommand = Effect.fn("invocation.resolveHostCliCommand
160160
const shim = (yield* HostProcess.Environment).T3CODE_CLI_PATH?.trim();
161161
const fs = yield* FileSystem.FileSystem;
162162
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))) {
163+
// Windows `t3.cmd` shims are text files that never realpath to the executable they run.
164+
const own = shim
165+
? yield* real(shim)
166+
: platform !== "win32" && (yield* HostProcess.IsExecutable)
167+
? yield* resolveEntryPath.pipe(
168+
Effect.flatMap((entry) =>
169+
real(entry).pipe(Effect.map((resolved) => resolved ?? entry)),
170+
),
171+
)
172+
: null;
173+
if (own === null || own === (yield* real(onPath))) {
165174
return { command: withArgs(command), launcher: false };
166175
}
167176
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.