Skip to content

Commit a9c8ec8

Browse files
committed
fix(cli): identify an unknown installed service home
1 parent df4b27c commit a9c8ec8

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

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

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,41 @@ it.layer(Layer.mergeAll(NodeServices.layer, NetService.layer))("service commands
127127
);
128128

129129
it.effect.each([
130-
{ label: "another home's service", installed: true, expected: "runs another T3 home" },
131-
{ label: "no service", installed: false, expected: "T3 Code service is not installed." },
130+
{
131+
label: "another home's service",
132+
installed: true,
133+
installedBaseDir: "/other/t3",
134+
expected: "runs another T3 home",
135+
},
136+
{
137+
label: "an unknown service home",
138+
installed: true,
139+
installedBaseDir: undefined,
140+
expected: "T3 home could not be determined",
141+
},
142+
{
143+
label: "no service",
144+
installed: false,
145+
installedBaseDir: undefined,
146+
expected: "T3 Code service is not installed.",
147+
},
132148
])("restart explains why it skipped $label", (input) =>
133149
Effect.gen(function* () {
134150
const fs = yield* FileSystem.FileSystem;
135151
const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-service-cli-test-" });
136152
vi.spyOn(BootService, "layer").mockReturnValue(
137153
Layer.succeed(
138154
BootService.BootService,
139-
makeTestService({ ...status, installed: input.installed }, "skipped").service,
155+
makeTestService(
156+
{
157+
...status,
158+
installed: input.installed,
159+
...(input.installedBaseDir === undefined
160+
? {}
161+
: { installedBaseDir: input.installedBaseDir }),
162+
},
163+
"skipped",
164+
).service,
140165
),
141166
);
142167

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ const serviceRestartCommand = Command.make("restart", projectLocationFlags).pipe
265265
: outcome === "queued"
266266
? `Queued a restart of the T3 Code service${onVersion}. This session runs inside the service and disconnects when it goes down.\nLogs: ${status.logPath}`
267267
: status.installed
268-
? "The installed service runs another T3 home, so it was not restarted. Pass its --base-dir."
268+
? status.installedBaseDir === undefined
269+
? `The installed service's T3 home could not be determined, so it was not restarted. Check ${status.unitPath}.`
270+
: "The installed service runs another T3 home, so it was not restarted. Pass its --base-dir."
269271
: "T3 Code service is not installed.",
270272
);
271273
}),

0 commit comments

Comments
 (0)