Adjust link command for updated error handling
This commit is contained in:
parent
6b5e92ac47
commit
72d83adaf3
@ -32,9 +32,16 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
keg.lock do
|
keg.lock do
|
||||||
print "Linking #{keg}... " do
|
print "Linking #{keg}... "
|
||||||
puts if ARGV.verbose?
|
puts if ARGV.verbose?
|
||||||
puts "#{keg.link(mode)} symlinks created"
|
|
||||||
|
begin
|
||||||
|
n = keg.link(mode)
|
||||||
|
rescue Keg::LinkError
|
||||||
|
puts
|
||||||
|
raise
|
||||||
|
else
|
||||||
|
puts "#{n} symlinks created"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -47,33 +54,4 @@ module Homebrew extend self
|
|||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Allows us to ensure a puts happens before the block exits so that if say,
|
|
||||||
# an exception is thrown, its output starts on a new line.
|
|
||||||
def print str, &block
|
|
||||||
Kernel.print str
|
|
||||||
|
|
||||||
STDERR.extend Module.new {
|
|
||||||
def puts(*args)
|
|
||||||
unless $did_puts
|
|
||||||
STDOUT.puts
|
|
||||||
$did_puts = true
|
|
||||||
end
|
|
||||||
super
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
puts_capture = Class.new do
|
|
||||||
def self.puts(*args)
|
|
||||||
$did_puts = true
|
|
||||||
Kernel.puts(*args)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
puts_capture.instance_eval(&block)
|
|
||||||
|
|
||||||
ensure
|
|
||||||
puts unless $did_puts
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user