Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: raise failures and handle later. #10389

Merged
merged 1 commit into from Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/Homebrew/cleanup.rb
Expand Up @@ -249,7 +249,7 @@ def cleanup_cask(cask, ds_store: true)
end

def cleanup_keg(keg)
cleanup_path(keg) { keg.uninstall }
cleanup_path(keg) { keg.uninstall(raise_failures: true) }
rescue Errno::EACCES => e
opoo e.message
unremovable_kegs << keg
Expand Down
4 changes: 3 additions & 1 deletion Library/Homebrew/keg.rb
Expand Up @@ -319,7 +319,7 @@ def remove_opt_record
opt_record.parent.rmdir_if_possible
end

def uninstall
def uninstall(raise_failures: false)
CacheStoreDatabase.use(:linkage) do |db|
break unless db.created?

Expand All @@ -333,6 +333,8 @@ def uninstall
remove_old_aliases
remove_oldname_opt_record
rescue Errno::EACCES, Errno::ENOTEMPTY
raise if raise_failures

odie <<~EOS
Could not remove #{name} keg! Do so manually:
sudo rm -rf #{path}
Expand Down