Accept one-key ask confirmations#22436
Merged
Merged
Conversation
6de37a0 to
a412e73
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Switches the brew --ask confirmation prompt from line-buffered gets (requires Enter) to single-keypress getch, so a lone y/Y proceeds and n/N/Enter aborts without needing Return.
Changes:
- Replace
$stdin.getswith$stdin.getchinask_input, drop theyes/noword forms, and update the invalid-input hint accordingly. require "io/console"ininstall.rbto enableIO#getch.- Update existing ask specs to stub
getchand add new specs coveringy/Yaccept andn/Ndecline single-key paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Library/Homebrew/install.rb | Adds io/console require and rewrites the ask prompt loop to read a single character, accepting only y and treating blank/n as abort. |
| Library/Homebrew/test/cmd/install_spec.rb | Updates the default-no test to stub getch, adds accept/decline single-char tests, and updates the no-TTY test to assert getch is not called. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a412e73 to
a17baa2
Compare
- Allow `brew --ask` prompts to proceed from `y` or `Y`. - Abort from `n` or `N` without waiting for a newline. - Treat Escape, Ctrl-D and Ctrl-C as quiet cancellation. - Reprompt after other keys so users choose explicitly.
a17baa2 to
e49b5ca
Compare
SMillerDev
approved these changes
May 28, 2026
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.
brew --askprompts to proceed fromyorY.norNwithout waiting for a newline.brew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex 5.5 xhigh with manual review and testing.