Skip to content

Read terminal size without invoking stty - #23952

Merged
MikeMcQuaid merged 1 commit into
mainfrom
terminal-size-without-stty
Sep 12, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
terminal-size-without-stty

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Query stdin with IO#winsize so uutils stty cannot stop in a background process group and hang Homebrew commands.
  • Preserve cached results and fallbacks for redirected stdin or failed terminal queries, with regression coverage.

Fixes #23951


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Codex with GPT 6 Astra at Extra High effort, with local review and testing.


Copilot AI balanced review requested due to automatic review settings September 12, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃煛 Changes recommended

Closed stdin raises an unhandled IOError, preventing existing size fallbacks.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Replaces stty size subprocess calls with Ruby鈥檚 direct terminal-size API.

Changes:

  • Reads and caches stdin terminal dimensions via IO#winsize.
  • Adds regression coverage for redirection, failures, memoisation and concurrency.
File summaries
File Description
Library/Homebrew/utils/tty.rb Queries terminal size without spawning stty.
Library/Homebrew/test/utils/tty_spec.rb Tests the new terminal-size behaviour.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/utils/tty.rb Outdated
- Query stdin with `IO#winsize` so uutils `stty` cannot stop in a
  background process group and hang Homebrew commands.
- Preserve cached results and fallbacks for redirected or closed
  stdin and failed terminal queries, with regression coverage.

Fixes #23951
@MikeMcQuaid
MikeMcQuaid force-pushed the terminal-size-without-stty branch from 1fb11e4 to dc495ad Compare September 12, 2026 19:56
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 12, 2026
Merged via the queue into main with commit 06cc132 Sep 12, 2026
53 of 54 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the terminal-size-without-stty branch September 12, 2026 20:21
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.

Multiple commands hang when terminal-size detection invokes uutils stty

3 participants