aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-04-21 09:40:24 -0500
committerJack Nagel2014-04-21 12:43:06 -0500
commit72d83adaf379d69f3b353a55acff7dc9e30a5656 (patch)
tree18a8e66ec7d2865cc349b98d3de8bf33dbf54614 /Library
parent6b5e92ac479c1ff529b420bc4ab7e17895178ec1 (diff)
downloadbrew-72d83adaf379d69f3b353a55acff7dc9e30a5656.tar.bz2
Adjust link command for updated error handling
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/link.rb42
1 files changed, 10 insertions, 32 deletions
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 840ad5353..ff39ce869 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -32,9 +32,16 @@ module Homebrew extend self
end
keg.lock do
- print "Linking #{keg}... " do
- puts if ARGV.verbose?
- puts "#{keg.link(mode)} symlinks created"
+ print "Linking #{keg}... "
+ puts if ARGV.verbose?
+
+ begin
+ n = keg.link(mode)
+ rescue Keg::LinkError
+ puts
+ raise
+ else
+ puts "#{n} symlinks created"
end
end
end
@@ -47,33 +54,4 @@ module Homebrew extend self
rescue FormulaUnavailableError
false
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