diff --git a/CHANGELOG.md b/CHANGELOG.md index 972472ef5..64de811a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ FEATURES: IMPROVEMENTS: + - Full Windows support in cmd.exe, PowerShell, Cygwin, and MingW based + environments. - By adding the "disabled" boolean flag to synced folders you can disable them altogether. [GH-1004] - Specify the default provider with the `VAGRANT_DEFAULT_PROVIDER` @@ -45,6 +47,8 @@ BUG FIXES: - Don't preserve modified time when untarring boxes. [GH-1539] - Forwarded port auto-correct will not auto-correct to a port that is also in use. + - Cygwin will always output color by default. Specify `--no-color` to + override this. ## 1.1.6 (April 3, 2013) diff --git a/bin/vagrant b/bin/vagrant index 895e2c160..04e16816e 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -22,18 +22,33 @@ $stderr.sync = true # environment. 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 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. +# Disable color in a few cases: +# +# * --no-color is anywhere in our arguments +# * STDOUT is not a TTY +# * The terminal doesn't support colors (Windows) +# +if ARGV.include?("--no-color") + # Delete the argument from the list so that it doesn't + # cause any invalid arguments down the road. ARGV.delete("--no-color") + opts[:ui_class] = Vagrant::UI::Basic -else - opts[:ui_class] = Vagrant::UI::Colored +elsif !Vagrant::Util::Platform.terminal_supports_colors? + opts[:ui_class] = Vagrant::UI::Basic +elsif !$stdout.tty? + # If we're not a TTY, verify we're not in Cygwin. Cygwin always + # reports that stdout is not a TTY, when in fact it is. + ENV["VAGRANT_DETECTED_OS"] ||= "" + + if !ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin") + opts[:ui_class] = Vagrant::UI::Basic + end end +# Default to colored output +opts[:ui_class] ||= Vagrant::UI::Colored + # This is kind of hacky, and I'd love to find a better way to do this, but # if we're accessing the plugin interface, we want to NOT load plugins # for this run, because they can actually interfere with the function diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 44a4b0a63..d8f626012 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -67,7 +67,8 @@ module Vagrant # output. def terminal_supports_colors? if windows? - return ENV.has_key?("ANSICON") + return ENV.has_key?("ANSICON") || + ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin") end true