diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 0cfdcad7ba..2242b7961a 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -468,9 +468,7 @@ module Cask 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], @@ -482,6 +480,10 @@ module Cask 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