fix: make doctor platform-aware

This commit is contained in:
Federico Jaramillo Martinez
2026-05-25 14:56:21 +02:00
parent 4bfd4acd40
commit 57a6a4a69f
5 changed files with 82 additions and 13 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { mkdtemp, rm, truncate, writeFile } from "node:fs/promises";
import { mkdtemp, realpath, rm, truncate, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { tmpdir } from "node:os";
import type { FastifyInstance } from "fastify";
@@ -15,7 +15,7 @@ let tempDir: string;
let projectDir: string;
beforeEach(async () => {
tempDir = await mkdtemp(join(tmpdir(), "pi-web-app-test-"));
tempDir = await realpath(await mkdtemp(join(tmpdir(), "pi-web-app-test-")));
projectDir = join(tempDir, "project");
app = await buildApp({
projects: new ProjectService(new ProjectStore(join(tempDir, "projects.json"))),
@@ -42,6 +42,8 @@ describe("node-pty macOS spawn-helper diagnostics", () => {
expect(formatted.ok).toBe(false);
expect(formatted.lines).toContain(` PI WEB tracking issue: ${PI_WEB_SPAWN_HELPER_ISSUE_URL}`);
expect(formatted.lines).toContain(` chmod +x '${fixture.helperPath}'`);
expect(formatted.lines).toContain(" Then run `pi-web doctor` again and retry opening a terminal.");
expect(formatted.lines.join("\n")).not.toContain("restart");
});
it("passes when the selected helper is executable", async () => {
+1 -1
View File
@@ -98,7 +98,7 @@ export function formatNodePtyDarwinSpawnHelperCheck(check: NodePtyDarwinSpawnHel
` PI WEB tracking issue: ${PI_WEB_SPAWN_HELPER_ISSUE_URL}`,
" Proposed workaround:",
` ${check.fixCommand}`,
" Then restart the pi-web-sessiond/pi-web-server processes.",
" Then run `pi-web doctor` again and retry opening a terminal.",
],
};
}