Skip to content

bug: review output cannot be captured (writes to /dev/tty) #181

Closed

Description

@ajianaz

Description

cora review spinner (indicatif::ProgressBar) writes to stderr using \r carriage returns + ANSI escapes. When stdout is piped or redirected, the final formatted output (print!("{}", result.output) in main.rs:556) does go to stdout correctly. The real issue is:

  1. No --output-file flag — no guaranteed way to capture output to a specific file
  2. Spinner not suppressed in non-TTY — indicatif auto-disables in some cases, but create_spinner() in llm.rs:247 and scanner.rs:66 always creates spinners regardless of TTY state
  3. Spinner code duplicated — separate ProgressBar creation in llm.rs and scanner.rs instead of centralized via ProgressReporter

Code References

File Line Issue
src/engine/llm.rs 247-257 create_spinner() always creates spinner, no TTY check
src/engine/scanner.rs 66-73 Same — always creates spinner
src/commands/review.rs 271-275 quiet flag skips spinner, but no auto-detect for non-TTY
src/main.rs 556 print!("{}", result.output) — this IS stdout, works correctly

Impact

  • Severity: Medium (not Critical as originally reported — output does reach stdout)
  • CI/CD pipelines work fine (GitHub Action captures stdout)
  • Local batch/scripted usage needs --quiet flag or output is polluted by spinner ANSI

Fix Plan

  1. Add --output-file <PATH> flag to cora review — write formatted output to file (guaranteed capture)
  2. Auto-detect non-TTY stdout → auto-set quiet=true and skip spinner creation
  3. Centralize spinner creation via ProgressReporter instead of duplicating in llm.rs/scanner.rs
  4. Add ProgressBar::draw_target() check — ProgressDrawTarget::stdout() returns hidden when piped

Target

  • Patch release: v0.4.4
  • Files: llm.rs, scanner.rs, progress.rs, review.rs, main.rs

Activity

  1. added
    bug
    on Jun 6, 2026
  2. added
    v0.5
    on Jun 7, 2026
  3. ajianaz commented on Jun 7, 2026

    @ajianaz
    CollaboratorAuthor

    All items in this issue have been addressed:

    1. Spinner suppressed in non-TTY — both llm.rs:253 and scanner.rs:69 check stderr().is_terminal() and set ProgressDrawTarget::hidden() when piped/redirected.

    2. --output-file flag — already implemented in main.rs:122 and main.rs:562-566. Writes formatted output to a specified file path.

    3. Spinner code duplication — remaining minor duplication between llm.rs:create_spinner() and scanner.rs inline creation. Low priority cosmetic refactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:highv0.5

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions