From 5ca89383f8db237496e6e5c5132d857672f7fdd2 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 6 Apr 2013 16:05:13 -0700 Subject: [PATCH] Simplify cygwin check everywhere --- bin/vagrant | 8 +------- lib/vagrant/util/platform.rb | 6 ++++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/bin/vagrant b/bin/vagrant index 04e16816ed6..fc2234582d2 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -36,14 +36,8 @@ if ARGV.include?("--no-color") opts[:ui_class] = Vagrant::UI::Basic 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") +elsif !$stdout.tty? && !Vagrant::Util::Platform.cygwin? opts[:ui_class] = Vagrant::UI::Basic - end end # Default to colored output diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index d8f626012ef..2f2e1b266cb 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -17,6 +17,9 @@ def leopard? end def cygwin? + return true if ENV["VAGRANT_DETECTED_OS"] && + ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin") + platform.include?("cygwin") end @@ -67,8 +70,7 @@ def platform_path(path) # output. def terminal_supports_colors? if windows? - return ENV.has_key?("ANSICON") || - ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin") + return ENV.has_key?("ANSICON") || cygwin? end true