Use headless terminal emulator (e.g., xterm.js) to handle progress bars and \r correctly
Resolved 💬 3 comments Opened Dec 11, 2025 by ykdojo Closed Dec 14, 2025
Problem
When running commands with progress bars or carriage return (\r) updates, Claude Code shows every single state instead of the final output. The \r characters are ignored rather than interpreted.
Example output from a 100-step progress bar:
Progress: [# ] 1%Progress: [## ] 2%Progress: [### ] 3%...Progress: [####] 100%
All 100 states are concatenated, consuming tokens unnecessarily.
Expected Behavior
Only the final state of each line should be captured, as it would appear in a real terminal.
Suggested Fix
Use a headless terminal emulator like xterm.js to properly interpret terminal control sequences (\r, ANSI escapes, etc.) before capturing output.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗