refactor(daemon): dedupe install output line writing

This commit is contained in:
Peter Steinberger
2026-02-18 23:58:05 +00:00
parent 89a0b95af4
commit 2709c0ba51
4 changed files with 42 additions and 11 deletions

View File

@@ -11,7 +11,7 @@ import {
buildLaunchAgentPlist as buildLaunchAgentPlistImpl,
readLaunchAgentProgramArgumentsFromFile,
} from "./launchd-plist.js";
import { formatLine, toPosixPath } from "./output.js";
import { formatLine, toPosixPath, writeFormattedLines } from "./output.js";
import { resolveGatewayStateDir, resolveHomeDir } from "./paths.js";
import { parseKeyValueOutput } from "./runtime-parse.js";
import type { GatewayServiceRuntime } from "./service-runtime.js";
@@ -407,9 +407,14 @@ export async function installLaunchAgent({
await execLaunchctl(["kickstart", "-k", `${domain}/${label}`]);
// Ensure we don't end up writing to a clack spinner line (wizards show progress without a newline).
stdout.write("\n");
stdout.write(`${formatLine("Installed LaunchAgent", plistPath)}\n`);
stdout.write(`${formatLine("Logs", stdoutPath)}\n`);
writeFormattedLines(
stdout,
[
{ label: "Installed LaunchAgent", value: plistPath },
{ label: "Logs", value: stdoutPath },
],
{ leadingBlankLine: true },
);
return { plistPath };
}