fix(cli): suppress progress bars when not TTY#230
Open
fix(cli): suppress progress bars when not TTY#230
Conversation
When stdout/stderr is not a terminal (e.g., captured by a parent process), OSC 9;4 progress sequences and carriage-return-based status lines produce massive output (247K chars for a typical update). This caused OpenClaw's qmd update to fail with 'too much output' errors, retrying ~24 times per 10 minutes. Gate all progress output on process.stderr.isTTY. Summary lines still print normally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
qmd updateorqmd embedruns inside a parent process (CI, cron, daemon, MCP server, editor plugin), the captured output is ~247K chars for a typical index with ~1600 documents. This is because:\x1b]9;4;1;N\x07) are written unconditionally to stderr\rIndexing: X/Y ETA: Zs) accumulate instead of overwriting (no terminal to interpret\r)This causes issues for any integration that captures output — in our case, OpenClaw's
qmd updatewas failing with "too much output" errors, retrying ~24 times per 10 minutes.Fix
Gate all progress/status output on
process.stderr.isTTY. Summary lines (Indexed: N new, M updated...) still print normally — only the ephemeral progress indicators are suppressed.Before (non-TTY): 247,296 chars
After (non-TTY): 6,639 chars
Changes
const isTTY = process.stderr.isTTYif (isTTY)\rIndexing: X/Yline inif (isTTY)if (isTTY)Minimal, no behavior change when running interactively.