aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/link.rb
diff options
context:
space:
mode:
authorJack Nagel2014-04-21 09:40:24 -0500
committerJack Nagel2014-04-21 12:43:06 -0500
commit19173bf362b292cd28b56c9a9a6ebbb9c8e667fa (patch)
treec174c6cc0c598f92ac48af6e4d1e07deeecb3158 /Library/Homebrew/cmd/link.rb
parent190fbf732347439de10484474e8aa0bb0d9b5df6 (diff)
downloadhomebrew-19173bf362b292cd28b56c9a9a6ebbb9c8e667fa.tar.bz2
Adjust link command for updated error handling
Diffstat (limited to 'Library/Homebrew/cmd/link.rb')
-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