From 3dd2a90decdba1441e2ebb31c50283b223837249 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sat, 13 Feb 2010 17:44:49 -0800 Subject: [PATCH] [Command Line] [Windows] Disable colorized output if win32console cannot be loaded. Closes GH-82 --- lib/compass/exec.rb | 6 +++++- lib/compass/logger.rb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 664db9d4..08b15e8e 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -6,7 +6,11 @@ require 'compass/actions' require 'compass/installers' require 'compass/commands' require 'rbconfig' -require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ +begin + require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ +rescue LoadError + $boring = true +end module Compass::Exec end diff --git a/lib/compass/logger.rb b/lib/compass/logger.rb index c0fd5ffd..7f726689 100644 --- a/lib/compass/logger.rb +++ b/lib/compass/logger.rb @@ -46,7 +46,11 @@ module Compass def color(c) if Compass.configuration.color_output && c && COLORS.has_key?(c.to_sym) - "\e[#{COLORS[c.to_sym]}m" + if defined?($boring) && $boring + "" + else + "\e[#{COLORS[c.to_sym]}m" + end else "" end