fix(setup): use fmtDuration in the container-build spinner
setup/lib/windowed-runner.ts was the one place on main still printing elapsed time as raw seconds (`(170s)`) instead of using the minute-aware `fmtDuration` helper from #2108. Two spots — the live spinner suffix that ticks during the build, and the success/error completion suffix — both now go through `fmtDuration`, so anything past 60 seconds renders as `Xm Ys` (e.g. `2m 50s`) like the rest of the setup flow. The miss happened because a separate PR (closed) was supposed to remove the timer entirely from this file, so #2108 deliberately skipped it. With that other PR closed, applying `fmtDuration` here is the consistent fix. Pure formatting change. The helper itself is unchanged from #2108; behavior under 60s is identical (`Xs`); behavior past 60s now matches everywhere else.
This commit is contained in:
@@ -23,7 +23,7 @@ import { emit as phEmit } from './diagnostics.js';
|
|||||||
import type { StepResult, SpinnerLabels } from './runner.js';
|
import type { StepResult, SpinnerLabels } from './runner.js';
|
||||||
import { dumpTranscriptOnFailure, spawnStep, writeStepEntry } from './runner.js';
|
import { dumpTranscriptOnFailure, spawnStep, writeStepEntry } from './runner.js';
|
||||||
import * as setupLog from '../logs.js';
|
import * as setupLog from '../logs.js';
|
||||||
import { brandBody, fitToWidth } from './theme.js';
|
import { brandBody, fitToWidth, fmtDuration } from './theme.js';
|
||||||
|
|
||||||
const WINDOW_SIZE = 3;
|
const WINDOW_SIZE = 3;
|
||||||
const SPINNER_FRAMES = ['◒', '◐', '◓', '◑'];
|
const SPINNER_FRAMES = ['◒', '◐', '◓', '◑'];
|
||||||
@@ -85,9 +85,8 @@ async function runUnderWindow(
|
|||||||
const redraw = (): void => {
|
const redraw = (): void => {
|
||||||
if (stallPromptActive) return;
|
if (stallPromptActive) return;
|
||||||
out.write(`\x1b[${WINDOW_SIZE + 1}A`);
|
out.write(`\x1b[${WINDOW_SIZE + 1}A`);
|
||||||
const elapsed = Math.round((Date.now() - start) / 1000);
|
|
||||||
const icon = SPINNER_FRAMES[frameIdx % SPINNER_FRAMES.length];
|
const icon = SPINNER_FRAMES[frameIdx % SPINNER_FRAMES.length];
|
||||||
const suffix = ` (${elapsed}s)`;
|
const suffix = ` (${fmtDuration(Date.now() - start)})`;
|
||||||
const header = fitToWidth(labels.running, suffix);
|
const header = fitToWidth(labels.running, suffix);
|
||||||
out.write(`\x1b[2K${k.cyan(icon)} ${header}${k.dim(suffix)}\n`);
|
out.write(`\x1b[2K${k.cyan(icon)} ${header}${k.dim(suffix)}\n`);
|
||||||
|
|
||||||
@@ -164,8 +163,7 @@ async function runUnderWindow(
|
|||||||
out.write(SHOW_CURSOR);
|
out.write(SHOW_CURSOR);
|
||||||
process.off('exit', restoreCursorOnExit);
|
process.off('exit', restoreCursorOnExit);
|
||||||
|
|
||||||
const elapsed = Math.round((Date.now() - start) / 1000);
|
const suffix = ` (${fmtDuration(Date.now() - start)})`;
|
||||||
const suffix = ` (${elapsed}s)`;
|
|
||||||
if (result.ok) {
|
if (result.ok) {
|
||||||
const isSkipped = result.terminal?.fields.STATUS === 'skipped';
|
const isSkipped = result.terminal?.fields.STATUS === 'skipped';
|
||||||
const msg = isSkipped && labels.skipped ? labels.skipped : labels.done;
|
const msg = isSkipped && labels.skipped ? labels.skipped : labels.done;
|
||||||
|
|||||||
Reference in New Issue
Block a user