Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions apps/server/src/serviceLauncher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,36 @@ process.exit(0);
}),
);

it.effect("starts the runtime in a T3 home whose name ends in a space", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const parent = yield* fs.makeTempDirectoryScoped({ prefix: "t3-service-launcher-space-" });
const root = path.join(parent, "T3 data ");
const versionDir = path.join(root, "runtime", "versions", "1.0.0");
yield* writeFakeRuntime(
fs,
path,
versionDir,
`
import { writeFileSync } from "node:fs";
writeFileSync(new URL("./started", import.meta.url), "");
process.exit(0);
`,
);
yield* fs.writeFileString(
path.join(root, "runtime", "service-state.json"),
JSON.stringify({ protocol: 4, activeVersion: "1.0.0" }),
);

yield* Effect.promise(() =>
expect(runLauncher(root)).rejects.toThrow("Active child exited unexpectedly (0)."),
);

assert.isTrue(yield* fs.exists(path.join(versionDir, "started")));
}),
);

it.effect("refuses non-install legacy documents without rewriting or spawning", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/serviceLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,8 @@ export interface LauncherOptions {
}

export async function main(options: LauncherOptions = {}): Promise<void> {
const baseDir = (options.baseDir ?? process.env.T3CODE_HOME)?.trim();
if (baseDir === undefined || baseDir === "") {
const baseDir = options.baseDir ?? process.env.T3CODE_HOME;
if (baseDir === undefined || baseDir.trim() === "") {
throw new Error("T3CODE_HOME is required by the T3 Code service launcher.");
}
const output =
Expand Down
Loading