Don't fail to migrate repo because of empty dir

I just ran into an issue where a colleague's Homebrew couldn't update.
It seems to have been because it failed once just after the new repo
directory was created. Since there was nothing in this directory, there
really isn't any reason for us to fail here, so to avoid this problem in
the future, try to `rmdir` the directory before failing because it already
exists.
This commit is contained in:
Alyssa Ross 2017-08-31 12:17:01 +01:00
parent e1bab7ede9
commit a6fa2f367b
No known key found for this signature in database
GPG Key ID: FAACA4C75A1F97E4

View File

@ -203,6 +203,7 @@ module Homebrew
end
new_homebrew_repository = Pathname.new "/usr/local/Homebrew"
new_homebrew_repository.rmdir_if_possible
if new_homebrew_repository.exist?
ofail <<-EOS.undent
#{new_homebrew_repository} already exists.