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

@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
import path from "node:path";
import { splitArgsPreservingQuotes } from "./arg-split.js";
import { resolveGatewayServiceDescription, resolveGatewayWindowsTaskName } from "./constants.js";
import { formatLine } from "./output.js";
import { formatLine, writeFormattedLines } from "./output.js";
import { resolveGatewayStateDir } from "./paths.js";
import { parseKeyValueOutput } from "./runtime-parse.js";
import { execSchtasks } from "./schtasks-exec.js";
@@ -230,9 +230,14 @@ export async function installScheduledTask({
await execSchtasks(["/Run", "/TN", taskName]);
// 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 Scheduled Task", taskName)}\n`);
stdout.write(`${formatLine("Task script", scriptPath)}\n`);
writeFormattedLines(
stdout,
[
{ label: "Installed Scheduled Task", value: taskName },
{ label: "Task script", value: scriptPath },
],
{ leadingBlankLine: true },
);
return { scriptPath };
}