Skip to content

Add cask upgrade quit opt-out#22383

Merged
MikeMcQuaid merged 1 commit into
mainfrom
cask-upgrade-no-quit
May 22, 2026
Merged

Add cask upgrade quit opt-out#22383
MikeMcQuaid merged 1 commit into
mainfrom
cask-upgrade-no-quit

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

Fixes #22376

  • 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.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex 5.5 xhigh with local review and testing.


@MikeMcQuaid MikeMcQuaid requested review from bevanjkay and Copilot May 22, 2026 11:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 (and HOMEBREW_NO_UPGRADE_QUIT_CASKS=1) to disable quitting running cask apps during upgrades.
  • Plumb a quit: option through Cask::UpgradeCask::Installer → uninstall stanza handling, skipping :quit directives 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. Returning true would better match the production method’s contract and avoid nil/unspecified return values leaking into upgrade_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.

Comment thread Library/Homebrew/test/cmd/upgrade_spec.rb
@MikeMcQuaid MikeMcQuaid force-pushed the cask-upgrade-no-quit branch from 3c40f7f to b0cdf48 Compare May 22, 2026 12:20
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks 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.
@MikeMcQuaid MikeMcQuaid force-pushed the cask-upgrade-no-quit branch from b0cdf48 to 0c8f0ac Compare May 22, 2026 15:28
@MikeMcQuaid MikeMcQuaid enabled auto-merge May 22, 2026 15:31
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 22, 2026
Merged via the queue into main with commit 5c1d2ca May 22, 2026
37 checks passed
@MikeMcQuaid MikeMcQuaid deleted the cask-upgrade-no-quit branch May 22, 2026 16:16
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.

Add an opt-out option to prevent cask apps from closing during brew upgrade

3 participants