diff --git a/CHANGELOG.md b/CHANGELOG.md index 72d3e2a8..9c4b2f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ uses this. [GH-661] - If there is only one bridgable interface, use that without asking the user. [GH-655] - + - The shell will have color output if ANSICON is installed on Windows. [GH-666] ## 0.9.1 (January 18, 2012) - Use `ifconfig device down` instead of `ifdown`. [GH-649] diff --git a/bin/vagrant b/bin/vagrant index 54d26b32..0703bd17 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -19,7 +19,7 @@ opts = {} # Disable color if the proper argument was passed or if we're # on Windows since the default Windows terminal doesn't support # colors. -if !Vagrant::Util::Platform.terminal_supports_colors? +if ARGV.include?("--no-color") || !$stdout.tty? || !Vagrant::Util::Platform.terminal_supports_colors? # Delete the argument from the list so that it doesn't cause any # invalid arguments down the road. ARGV.delete("--no-color") diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 6eee2880..52b39d4b 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -44,9 +44,14 @@ module Vagrant !bit64? end + # Returns a boolean noting whether the terminal supports color. + # output. def terminal_supports_colors? - !$stdout.tty? || ARGV.include?("--no-color") || - (Vagrant::Util::Platform.windows? ? ENV['ansicon'] : false) + if windows? + return ENV.has_key?("ANSICON") + end + + true end def tar_file_options