Skip to content

Commit

Permalink
Simplify cygwin check everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Apr 6, 2013
1 parent fb9c311 commit 5ca8938
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 1 addition & 7 deletions bin/vagrant
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions lib/vagrant/util/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5ca8938

Please sign in to comment.