Merge pull request #10389 from MikeMcQuaid/cleanup_raise

cleanup: raise failures and handle later.
This commit is contained in:
Mike McQuaid 2021-01-21 15:55:39 +00:00 committed by GitHub
commit f6bc3efac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -249,7 +249,7 @@ module Homebrew
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

View File

@ -319,7 +319,7 @@ class Keg
opt_record.parent.rmdir_if_possible
end
def uninstall
def uninstall(raise_failures: false)
CacheStoreDatabase.use(:linkage) do |db|
break unless db.created?
@ -333,6 +333,8 @@ class Keg
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}