aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-09-25 21:16:17 +0800
committerXu Cheng2015-09-26 13:51:56 +0800
commit1b33c70d46fa49aae9817d9b8cba9f5b0d34a5d4 (patch)
treee6d4f2830fdd7ec97b81c6cc03ec6b3fa36a2669
parent7b97dca554459892f11f7ee28aa7eb12c763a549 (diff)
downloadbrew-1b33c70d46fa49aae9817d9b8cba9f5b0d34a5d4.tar.bz2
FormulaInstaller: cleanup files when pouring bottle failed
Closes Homebrew/homebrew#44325. Signed-off-by: Xu Cheng <xucheng@me.com>
-rw-r--r--Library/Homebrew/formula_installer.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 0ac94a40c..0d9943a07 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -189,7 +189,12 @@ class FormulaInstaller
begin
install_relocation_tools unless formula.bottle_specification.skip_relocation?
pour
- rescue => e
+ rescue Exception => e
+ # any exceptions must leave us with nothing installed
+ ignore_interrupts do
+ formula.prefix.rmtree if formula.prefix.directory?
+ formula.rack.rmdir_if_possible
+ end
raise if ARGV.homebrew_developer?
@pour_failed = true
onoe e.message