Skip to content

Commit

Permalink
Merge pull request #18904 from Homebrew/update-cask-uninstall-trash-m…
Browse files Browse the repository at this point in the history
…essaging

cask/artifact/abstract_uninstall: handle sudo trashed paths correctly
  • Loading branch information
MikeMcQuaid authored Dec 9, 2024
2 parents 8fa9b72 + ebede56 commit ff7b953
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Library/Homebrew/cask/artifact/abstract_uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,7 @@ def trash_paths(*paths, command: nil, **_)
trashed = trashed.split(":")
untrashable = untrashable.split(":")

return trashed, untrashable if untrashable.empty?

untrashable.delete_if do |path|
trashed_with_permissions, untrashable = untrashable.partition do |path|
Utils.gain_permissions(path, ["-R"], SystemCommand) do
system_command! HOMEBREW_LIBRARY_PATH/"cask/utils/trash.swift",
args: [path],
Expand All @@ -482,6 +480,10 @@ def trash_paths(*paths, command: nil, **_)
false
end

trashed += trashed_with_permissions

return trashed, untrashable if untrashable.empty?

opoo "The following files could not be trashed, please do so manually:"
$stderr.puts untrashable

Expand Down

0 comments on commit ff7b953

Please sign in to comment.