aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/install.rb
diff options
context:
space:
mode:
authorXiyue Deng2013-08-28 04:51:24 -0700
committerSamuel John2013-09-05 14:02:29 +0200
commit8aae1dac7b82457e93ca7f2f5e234380bfbf79fc (patch)
tree066bd6dd2a1535d0f98c6d054ff2e59badd0afff /Library/Homebrew/cmd/install.rb
parente278135156dc318b55dd4095d271d92c66bc8638 (diff)
downloadbrew-8aae1dac7b82457e93ca7f2f5e234380bfbf79fc.tar.bz2
Make reinstall transaction safe.
* Aborting during reinstall will now restore the originally installed keg. - Change install code to pass on CannotInstallFormulaError exception to caller so it can be reused in reinstall. * Add "--force-new-install" flag to force installing a new formula. Closes Homebrew/homebrew#22190. Signed-off-by: Samuel John <github@SamuelJohn.de>
Diffstat (limited to 'Library/Homebrew/cmd/install.rb')
-rw-r--r--Library/Homebrew/cmd/install.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 46bc59b91..2fe22cfa4 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -19,7 +19,13 @@ module Homebrew extend self
end unless ARGV.force?
perform_preinstall_checks
- ARGV.formulae.each { |f| install_formula(f) }
+ ARGV.formulae.each do |f|
+ begin
+ install_formula(f)
+ rescue CannotInstallFormulaError => e
+ ofail e.message
+ end
+ end
end
def check_ppc
@@ -80,7 +86,6 @@ module Homebrew extend self
# another formula. In that case, don't generate an error, just move on.
rescue FormulaAlreadyInstalledError => e
opoo e.message
- rescue CannotInstallFormulaError => e
- ofail e.message
+ # Ignore CannotInstallFormulaError and let caller handle it.
end
end