From 1f0d424459e3c3a3002d5a6788904b8e4abdf9f0 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 27 Mar 2014 16:24:57 -0500 Subject: [PATCH] link: fix output ordering when exceptions are raised --- Library/Homebrew/cmd/link.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb index 742195d6db..840ad53535 100644 --- a/Library/Homebrew/cmd/link.rb +++ b/Library/Homebrew/cmd/link.rb @@ -52,6 +52,17 @@ module Homebrew extend self # 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