From 1b33c70d46fa49aae9817d9b8cba9f5b0d34a5d4 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 25 Sep 2015 21:16:17 +0800 Subject: [PATCH] FormulaInstaller: cleanup files when pouring bottle failed Closes Homebrew/homebrew#44325. Signed-off-by: Xu Cheng --- Library/Homebrew/formula_installer.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 0ac94a40ca..0d9943a07e 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