Simplify cygwin check everywhere
This commit is contained in:
parent
fb9c311b4d
commit
5ca89383f8
|
@ -36,14 +36,8 @@ if ARGV.include?("--no-color")
|
||||||
opts[:ui_class] = Vagrant::UI::Basic
|
opts[:ui_class] = Vagrant::UI::Basic
|
||||||
elsif !Vagrant::Util::Platform.terminal_supports_colors?
|
elsif !Vagrant::Util::Platform.terminal_supports_colors?
|
||||||
opts[:ui_class] = Vagrant::UI::Basic
|
opts[:ui_class] = Vagrant::UI::Basic
|
||||||
elsif !$stdout.tty?
|
elsif !$stdout.tty? && !Vagrant::Util::Platform.cygwin?
|
||||||
# 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
|
opts[:ui_class] = Vagrant::UI::Basic
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Default to colored output
|
# Default to colored output
|
||||||
|
|
|
@ -17,6 +17,9 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def cygwin?
|
def cygwin?
|
||||||
|
return true if ENV["VAGRANT_DETECTED_OS"] &&
|
||||||
|
ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin")
|
||||||
|
|
||||||
platform.include?("cygwin")
|
platform.include?("cygwin")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -67,8 +70,7 @@ module Vagrant
|
||||||
# output.
|
# output.
|
||||||
def terminal_supports_colors?
|
def terminal_supports_colors?
|
||||||
if windows?
|
if windows?
|
||||||
return ENV.has_key?("ANSICON") ||
|
return ENV.has_key?("ANSICON") || cygwin?
|
||||||
ENV["VAGRANT_DETECTED_OS"].downcase.include?("cygwin")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in New Issue