cask/uninstall: don't quit or signal the host process - #23695
Open
bevanjkay wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents cask uninstall actions from terminating the application hosting the current brew process.
Changes:
- Resolves host bundle IDs from cached process ancestry.
- Skips matching
quitandsignalactions. - Adds safeguard tests and updates shared examples.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
Library/Homebrew/cask/artifact/abstract_uninstall.rb |
Adds host detection and safeguards. |
Library/Homebrew/test/cask/artifact/uninstall_spec.rb |
Tests quit and signal protections. |
Library/Homebrew/test/cask/artifact/shared_examples/uninstall_zap.rb |
Stubs ancestry lookup in shared tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
MikeMcQuaid
reviewed
Aug 29, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Thanks, good idea, let's just see if we can avoid osascript.
Comment on lines
+365
to
+383
| ANCESTOR_BUNDLE_IDS_SCRIPT = <<~JAVASCRIPT | ||
| 'use strict'; | ||
|
|
||
| ObjC.import('AppKit') | ||
|
|
||
| function run(argv) { | ||
| var bundleIds = [] | ||
|
|
||
| for (var i = 0; i < argv.length; i++) { | ||
| var app = $.NSRunningApplication.runningApplicationWithProcessIdentifier(parseInt(argv[i], 10)) | ||
| if (!app.isNil() && !app.bundleIdentifier.isNil()) { | ||
| bundleIds.push(ObjC.unwrap(app.bundleIdentifier)) | ||
| } | ||
| } | ||
|
|
||
| return bundleIds.join("\\n") | ||
| } | ||
| JAVASCRIPT | ||
| private_constant :ANCESTOR_BUNDLE_IDS_SCRIPT |
Member
There was a problem hiding this comment.
Can we try to use FFI or similar instead? This should also be doable without osascript I'd think. If the only way to do this is embedded JS: let's instead move the logic to a dedicated file for syntax highlighting etc.
Comment on lines
+35
to
+38
| bundle_identifier = ObjectiveC.message_send(application, "bundleIdentifier", [], Fiddle::TYPE_VOIDP) | ||
| return if bundle_identifier.null? | ||
|
|
||
| ObjectiveC.message_send(bundle_identifier, "UTF8String", [], Fiddle::TYPE_VOIDP).to_s |
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.
brewfrom quitting or signalling its host terminal.brewinvocation.quitandsignalsafeguards.Resolves Homebrew/homebrew-cask#283947
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?I used
claude-codewith Fable 5, reviewed and tested the changes myself, and withGPT-5.6-Sol.