aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_installer.rb
diff options
context:
space:
mode:
authorMax Howell2012-09-11 20:59:59 -0400
committerMax Howell2012-09-25 11:31:56 -0400
commita217b03952fca6df22ecc62523d9c85883aef856 (patch)
tree82d30ca49fa0224ac6339a5c4399b3de6ba4c49f /Library/Homebrew/formula_installer.rb
parent1100818100ae07fa49419b4ab69ebbeb59a7615d (diff)
downloadbrew-a217b03952fca6df22ecc62523d9c85883aef856.tar.bz2
Clean up and improve build-error output and logs
All logs are now stored from each command executed in Formula.install. Error output is truncated to five lines in an attempt to not overwhelm the user and to encourage users to read the error output and report the bug properly. Maybe we can get that figure up from 70% to 90%.
Diffstat (limited to 'Library/Homebrew/formula_installer.rb')
-rw-r--r--Library/Homebrew/formula_installer.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index d9cff505c..213704107 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -200,6 +200,8 @@ class FormulaInstaller
end
def build
+ FileUtils.rm Dir["#{HOMEBREW_LOGS}/#{f}/*"]
+
@start_time = Time.now
# 1. formulae can modify ENV, so we must ensure that each
@@ -236,7 +238,7 @@ class FormulaInstaller
end
end
- ignore_interrupts do # the fork will receive the interrupt and marshall it back
+ ignore_interrupts(:quietly) do # the fork will receive the interrupt and marshall it back
write.close
Process.wait
data = read.read
@@ -245,18 +247,14 @@ class FormulaInstaller
raise "Suspicious installation failure" unless $?.success?
end
- # This is the installation receipt. The reason this comment is necessary
- # is because some numpty decided to call the class Tab rather than
- # the far more appropriate InstallationReceipt :P
- Tab.for_install(f, args).write
+ raise "Empty installation" if Dir["#{f.prefix}/*"].empty?
+
+ Tab.for_install(f, args).write # INSTALL_RECEIPT.json
rescue Exception => e
ignore_interrupts do
# any exceptions must leave us with nothing installed
- if f.prefix.directory?
- puts "One sec, just cleaning up..." if e.kind_of? Interrupt
- f.prefix.rmtree
- end
+ f.prefix.rmtree if f.prefix.directory?
f.rack.rmdir_if_possible
end
raise