fix: suppress spinner in logs --follow mode
The progress spinner was being shown for each gateway RPC call during log tailing, causing repeated spinner frames (◇ │) to appear every polling interval. Add a `progress` option to `callGatewayFromCli` and disable the spinner during follow mode polling to keep output clean. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,14 +41,16 @@ function parsePositiveInt(value: string | undefined, fallback: number): number {
|
||||
async function fetchLogs(
|
||||
opts: LogsCliOptions,
|
||||
cursor: number | undefined,
|
||||
showProgress: boolean,
|
||||
): Promise<LogsTailPayload> {
|
||||
const limit = parsePositiveInt(opts.limit, 200);
|
||||
const maxBytes = parsePositiveInt(opts.maxBytes, 250_000);
|
||||
const payload = await callGatewayFromCli("logs.tail", opts, {
|
||||
cursor,
|
||||
limit,
|
||||
maxBytes,
|
||||
});
|
||||
const payload = await callGatewayFromCli(
|
||||
"logs.tail",
|
||||
opts,
|
||||
{ cursor, limit, maxBytes },
|
||||
{ progress: showProgress },
|
||||
);
|
||||
if (!payload || typeof payload !== "object") {
|
||||
throw new Error("Unexpected logs.tail response");
|
||||
}
|
||||
@@ -194,8 +196,10 @@ export function registerLogsCli(program: Command) {
|
||||
|
||||
while (true) {
|
||||
let payload: LogsTailPayload;
|
||||
// Show progress spinner only on first fetch, not during follow polling
|
||||
const showProgress = first && !opts.follow;
|
||||
try {
|
||||
payload = await fetchLogs(opts, cursor);
|
||||
payload = await fetchLogs(opts, cursor, showProgress);
|
||||
} catch (err) {
|
||||
emitGatewayError(err, opts, jsonMode ? "json" : "text", rich, emitJsonLine, errorLine);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user