Add cask upgrade quit opt-out#22383
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-out for the cask upgrade behavior that quits (and then reopens) running GUI applications, addressing issue #22376 by allowing users to keep apps running during brew upgrade.
Changes:
- Add
brew upgrade --no-quit(andHOMEBREW_NO_UPGRADE_QUIT_CASKS=1) to disable quitting running cask apps during upgrades. - Plumb a
quit:option throughCask::Upgrade→Cask::Installer→ uninstall stanza handling, skipping:quitdirectives and skipping reopen when opted out. - Add regression tests covering the command flag/env behavior and uninstall-stanza directive filtering.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Library/Homebrew/cmd/upgrade.rb | Adds --no-quit option and passes quit: through to cask upgrades. |
| Library/Homebrew/env_config.rb | Introduces HOMEBREW_NO_UPGRADE_QUIT_CASKS env configuration. |
| Library/Homebrew/cask/upgrade.rb | Adds/threads quit: through upgrade flow; skips reopening when quit is false. |
| Library/Homebrew/cask/installer.rb | Adds quit: plumbing into upgrade uninstall path and forwards it to uninstall stanzas. |
| Library/Homebrew/cask/artifact/uninstall.rb | Adds quit: option to uninstall phase and filters out :quit directive when disabled. |
| Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi | Adds no_upgrade_quit_casks? signature. |
| Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/upgrade_cmd.rbi | Adds no_quit? args signature for the new CLI switch. |
| Library/Homebrew/test/cmd/upgrade_spec.rb | Tests --no-quit and env var wiring into Cask::Upgrade. |
| Library/Homebrew/test/cask/upgrade_spec.rb | Tests propagation of quit: option into per-cask upgrade calls. |
| Library/Homebrew/test/cask/artifact/uninstall_spec.rb | Tests skipping :quit directive during upgrade when quit: false. |
Files not reviewed (2)
- Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/upgrade_cmd.rbi: Language not supported
- Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi: Language not supported
Comments suppressed due to low confidence (1)
Library/Homebrew/test/cmd/upgrade_spec.rb:182
- This mocked
Cask::Upgrade.upgrade_casks!call doesn’t return a boolean. Returningtruewould better match the production method’s contract and avoid nil/unspecified return values leaking intoupgrade_outdated_casks!if future code starts depending on it.
expect(Cask::Upgrade).to receive(:upgrade_casks!) do |*_, **kwargs|
expect(kwargs[:quit]).to be(false)
end
cmd.send(:upgrade_outdated_casks!, [])
end
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3c40f7f to
b0cdf48
Compare
bevanjkay
approved these changes
May 22, 2026
- Support `--no-quit` for users who need cask apps left open. - Add `HOMEBREW_NO_UPGRADE_QUIT_CASKS` for persistent opt-out. - Cover command, upgrade and uninstall-stanza paths with regressions.
b0cdf48 to
0c8f0ac
Compare
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.
Fixes #22376
--no-quitfor users who need cask apps left open.HOMEBREW_NO_UPGRADE_QUIT_CASKSfor persistent opt-out.brew lgtm(style, typechecking and tests) with your changes locally?OpenAI Codex 5.5 xhigh with local review and testing.