Skip to content

Fix the CLI when it is not attached to a TTY#4424

Merged
hansl merged 2 commits intoboa-dev:mainfrom
hansl:fix-cli-files
Sep 19, 2025
Merged

Fix the CLI when it is not attached to a TTY#4424
hansl merged 2 commits intoboa-dev:mainfrom
hansl:fix-cli-files

Conversation

@hansl
Copy link
Contributor

@hansl hansl commented Sep 18, 2025

This a simple fix when the CLI is not attached to a TTY. In those cases it would print an error readline thread failed: ENOTTY: Not a typewriter.

This fixes it by doing three things;

  1. by default, if no printers has been set, use stdout normally. This makes sense as if any logging occurs before readline can be initialized, we still want to see it.
  2. move back starting the readline loop after args files/expressions are handled.
  3. if we cannot build a writer for some reason, don't stop the thread. readline still works, but printers won't, so we just show logs on stdout. This can happen if STDIN is a pipe.

@hansl hansl requested a review from a team September 18, 2025 22:21
@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.26%. Comparing base (6ddc2b4) to head (5062f53).
⚠️ Report is 532 commits behind head on main.

Files with missing lines Patch % Lines
cli/src/main.rs 0.00% 3 Missing ⚠️
cli/src/logger.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4424      +/-   ##
==========================================
+ Coverage   47.24%   51.26%   +4.02%     
==========================================
  Files         476      502      +26     
  Lines       46892    51292    +4400     
==========================================
+ Hits        22154    26297    +4143     
- Misses      24738    24995     +257     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hansl hansl added this pull request to the merge queue Sep 19, 2025
Merged via the queue into boa-dev:main with commit 601972b Sep 19, 2025
16 checks passed
@hansl hansl deleted the fix-cli-files branch September 19, 2025 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants