Read terminal size without invoking stty - #23952
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
馃煛 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.
p-linnane
approved these changes
Sep 12, 2026
- 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
force-pushed
the
terminal-size-without-stty
branch
from
September 12, 2026 19:56
1fb11e4 to
dc495ad
Compare
MikeMcQuaid
enabled auto-merge
September 12, 2026 19:56
6 tasks
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.
IO#winsizeso uutilssttycannot stop in a background process group and hang Homebrew commands.Fixes #23951
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Codex with GPT 6 Astra at Extra High effort, with local review and testing.