enable colors on Windows when using ANSICON
This commit is contained in:
parent
4ead6e3f82
commit
b9046a5594
|
@ -19,7 +19,7 @@ opts = {}
|
||||||
# Disable color if the proper argument was passed or if we're
|
# Disable color if the proper argument was passed or if we're
|
||||||
# on Windows since the default Windows terminal doesn't support
|
# on Windows since the default Windows terminal doesn't support
|
||||||
# colors.
|
# 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
|
# Delete the argument from the list so that it doesn't cause any
|
||||||
# invalid arguments down the road.
|
# invalid arguments down the road.
|
||||||
ARGV.delete("--no-color")
|
ARGV.delete("--no-color")
|
||||||
|
|
|
@ -44,6 +44,11 @@ module Vagrant
|
||||||
!bit64?
|
!bit64?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def terminal_supports_colors?
|
||||||
|
!$stdout.tty? || ARGV.include?("--no-color") ||
|
||||||
|
(Vagrant::Util::Platform.windows? ? ENV['ansicon'] : false)
|
||||||
|
end
|
||||||
|
|
||||||
def tar_file_options
|
def tar_file_options
|
||||||
# create, write only, fail if the file exists, binary if windows
|
# create, write only, fail if the file exists, binary if windows
|
||||||
File::WRONLY | File::EXCL | File::CREAT | (windows? ? File::BINARY : 0)
|
File::WRONLY | File::EXCL | File::CREAT | (windows? ? File::BINARY : 0)
|
||||||
|
|
Loading…
Reference in New Issue