enable colors on Windows when using ANSICON

This commit is contained in:
Jarmo Pertman 2012-01-20 17:51:26 +02:00 committed by Mitchell Hashimoto
parent 4ead6e3f82
commit b9046a5594
2 changed files with 6 additions and 1 deletions

View File

@ -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 !$stdout.tty? || ARGV.include?("--no-color") || Vagrant::Util::Platform.windows?
if !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")

View File

@ -44,6 +44,11 @@ module Vagrant
!bit64?
end
def terminal_supports_colors?
!$stdout.tty? || ARGV.include?("--no-color") ||
(Vagrant::Util::Platform.windows? ? ENV['ansicon'] : false)
end
def tar_file_options
# create, write only, fail if the file exists, binary if windows
File::WRONLY | File::EXCL | File::CREAT | (windows? ? File::BINARY : 0)