Exit with bad exit code on command failures.
This commit is contained in:
parent
61444ee3a6
commit
0cbdeeaa3c
@ -420,7 +420,7 @@ module Homebrew extend self
|
||||
|
||||
if errors
|
||||
puts "#{problem_count} problems in #{brew_count} brews"
|
||||
exit 1
|
||||
Homebrew.failed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,8 +4,16 @@ require 'tab'
|
||||
|
||||
module Homebrew extend self
|
||||
def bottle_formula f
|
||||
return onoe "Formula not installed: #{f.name}" unless f.installed?
|
||||
return onoe "Formula not installed with '--build-bottle': #{f.name}" unless built_bottle? f
|
||||
unless f.installed?
|
||||
onoe "Formula not installed: #{f.name}"
|
||||
Homebrew.failed = true
|
||||
return
|
||||
end
|
||||
|
||||
unless built_bottle? f
|
||||
onoe "Formula not installed with '--build-bottle': #{f.name}"
|
||||
Homebrew.failed = true
|
||||
end
|
||||
|
||||
directory = Pathname.pwd
|
||||
filename = bottle_filename f
|
||||
|
@ -879,22 +879,19 @@ end # end class Checks
|
||||
|
||||
module Homebrew extend self
|
||||
def doctor
|
||||
raring_to_brew = true
|
||||
|
||||
checks = Checks.new
|
||||
|
||||
checks.methods.select{ |method| method =~ /^check_/ }.sort.each do |method|
|
||||
out = checks.send(method)
|
||||
unless out.nil? or out.empty?
|
||||
puts unless raring_to_brew
|
||||
puts unless Homebrew.failed?
|
||||
lines = out.to_s.split('\n')
|
||||
opoo lines.shift
|
||||
puts lines
|
||||
raring_to_brew = false
|
||||
Homebrew.failed = true
|
||||
end
|
||||
end
|
||||
|
||||
puts "Your system is raring to brew." if raring_to_brew
|
||||
exit raring_to_brew ? 0 : 1
|
||||
puts "Your system is raring to brew." unless Homebrew.failed?
|
||||
end
|
||||
end
|
||||
|
@ -77,6 +77,7 @@ module Homebrew extend self
|
||||
fi.finish
|
||||
rescue CannotInstallFormulaError => e
|
||||
onoe e.message
|
||||
Homebrew.failed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -13,21 +13,24 @@ module Homebrew extend self
|
||||
# Cannot test uninstalled formulae
|
||||
unless f.installed?
|
||||
puts "#{f.name} not installed"
|
||||
Homebrew.failed = true
|
||||
next
|
||||
end
|
||||
|
||||
# Cannot test formulae without a test method
|
||||
unless f.respond_to? :test
|
||||
puts "#{f.name} defines no test"
|
||||
Homebrew.failed = true
|
||||
next
|
||||
end
|
||||
|
||||
puts "Testing #{f.name}"
|
||||
begin
|
||||
# tests can also return false to indicate failure
|
||||
puts "#{f.name}: failed" if f.test == false
|
||||
raise if f.test == false
|
||||
rescue
|
||||
puts "#{f.name}: failed"
|
||||
Homebrew.failed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -35,5 +35,6 @@ module Homebrew extend self
|
||||
rescue MultipleVersionsInstalledError => e
|
||||
onoe e
|
||||
puts "Use `brew remove --force #{e.name}` to remove all versions."
|
||||
Homebrew.failed = true
|
||||
end
|
||||
end
|
||||
|
@ -67,9 +67,11 @@ module Homebrew extend self
|
||||
installer.finish
|
||||
rescue CannotInstallFormulaError => e
|
||||
onoe e
|
||||
Homebrew.failed = true
|
||||
rescue BuildError => e
|
||||
e.dump
|
||||
puts
|
||||
Homebrew.failed = true
|
||||
ensure
|
||||
# restore previous installation state if build failed
|
||||
outdated_keg.link if outdated_keg and not f.installed? rescue nil
|
||||
|
@ -79,6 +79,9 @@ HOMEBREW_CURL_ARGS = '-qf#LA'
|
||||
require 'fileutils'
|
||||
module Homebrew extend self
|
||||
include FileUtils
|
||||
|
||||
attr_accessor :failed
|
||||
alias_method :failed?, :failed
|
||||
end
|
||||
|
||||
FORMULA_META_FILES = %w[README README.md ChangeLog CHANGES COPYING LICENSE LICENCE COPYRIGHT AUTHORS]
|
||||
|
Loading…
x
Reference in New Issue
Block a user