From 31519887cda6fef0d8d870ba5da33ca908e7c7d8 Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Sun, 9 Oct 2011 00:10:39 -0700 Subject: [PATCH] ui: print to STDERR (play nice with UNIX pipes) --- lib/guard/ui.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/guard/ui.rb b/lib/guard/ui.rb index 80ff7d4..47fd0a4 100644 --- a/lib/guard/ui.rb +++ b/lib/guard/ui.rb @@ -15,7 +15,7 @@ module Guard def info(message, options = { }) unless ENV['GUARD_ENV'] == 'test' reset_line if options[:reset] - puts color(message) if message != '' + STDERR.puts color(message) if message != '' end end @@ -27,7 +27,7 @@ module Guard def error(message, options = { }) unless ENV['GUARD_ENV'] == 'test' reset_line if options[:reset] - puts color('ERROR: ', :red) + message + STDERR.puts color('ERROR: ', :red) + message end end @@ -39,7 +39,7 @@ module Guard def deprecation(message, options = { }) unless ENV['GUARD_ENV'] == 'test' reset_line if options[:reset] - puts color('DEPRECATION: ', :red) + message + STDERR.puts color('DEPRECATION: ', :red) + message end end @@ -51,14 +51,14 @@ module Guard def debug(message, options = { }) unless ENV['GUARD_ENV'] == 'test' reset_line if options[:reset] - puts color("DEBUG (#{Time.now.strftime('%T')}): ", :yellow) + message if ::Guard.options && ::Guard.options[:debug] + STDERR.puts color("DEBUG (#{Time.now.strftime('%T')}): ", :yellow) + message if ::Guard.options && ::Guard.options[:debug] end end # Reset a line. # def reset_line - print(color_enabled? ? "\r\e[0m" : "\r\n") + STDERR.print(color_enabled? ? "\r\e[0m" : "\r\n") end # Clear the output.