mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 00:50:22 +00:00
fix(test): strip windows drive prefix from darwin hints
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { resolveGatewayLogPaths } from "./launchd.js";
|
||||
import { toPosixPath } from "./output.js";
|
||||
|
||||
function toDarwinDisplayPath(value: string): string {
|
||||
return toPosixPath(value).replace(/^[A-Za-z]:/, "");
|
||||
}
|
||||
|
||||
export function buildPlatformRuntimeLogHints(params: {
|
||||
platform?: NodeJS.Platform;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
@@ -12,8 +16,8 @@ export function buildPlatformRuntimeLogHints(params: {
|
||||
if (platform === "darwin") {
|
||||
const logs = resolveGatewayLogPaths(env);
|
||||
return [
|
||||
`Launchd stdout (if installed): ${toPosixPath(logs.stdoutPath)}`,
|
||||
`Launchd stderr (if installed): ${toPosixPath(logs.stderrPath)}`,
|
||||
`Launchd stdout (if installed): ${toDarwinDisplayPath(logs.stdoutPath)}`,
|
||||
`Launchd stderr (if installed): ${toDarwinDisplayPath(logs.stderrPath)}`,
|
||||
];
|
||||
}
|
||||
if (platform === "linux") {
|
||||
|
||||
30
src/daemon/runtime-hints.windows-paths.test.ts
Normal file
30
src/daemon/runtime-hints.windows-paths.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
afterEach(() => {
|
||||
vi.resetModules();
|
||||
vi.doUnmock("./launchd.js");
|
||||
});
|
||||
|
||||
describe("buildPlatformRuntimeLogHints", () => {
|
||||
it("strips windows drive prefixes from darwin display paths", async () => {
|
||||
vi.doMock("./launchd.js", () => ({
|
||||
resolveGatewayLogPaths: () => ({
|
||||
stdoutPath: "C:\\tmp\\openclaw-state\\logs\\gateway.log",
|
||||
stderrPath: "C:\\tmp\\openclaw-state\\logs\\gateway.err.log",
|
||||
}),
|
||||
}));
|
||||
|
||||
const { buildPlatformRuntimeLogHints } = await import("./runtime-hints.js");
|
||||
|
||||
expect(
|
||||
buildPlatformRuntimeLogHints({
|
||||
platform: "darwin",
|
||||
systemdServiceName: "openclaw-gateway",
|
||||
windowsTaskName: "OpenClaw Gateway",
|
||||
}),
|
||||
).toEqual([
|
||||
"Launchd stdout (if installed): /tmp/openclaw-state/logs/gateway.log",
|
||||
"Launchd stderr (if installed): /tmp/openclaw-state/logs/gateway.err.log",
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user