Clean up some impl [GH-666]

This commit is contained in:
Mitchell Hashimoto 2012-01-20 11:25:39 -08:00
parent b9046a5594
commit 97235ee080
3 changed files with 9 additions and 4 deletions

View File

@ -15,7 +15,7 @@
uses this. [GH-661]
- If there is only one bridgable interface, use that without asking
the user. [GH-655]
- The shell will have color output if ANSICON is installed on Windows. [GH-666]
## 0.9.1 (January 18, 2012)
- Use `ifconfig device down` instead of `ifdown`. [GH-649]

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 !Vagrant::Util::Platform.terminal_supports_colors?
if ARGV.include?("--no-color") || !$stdout.tty? || !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,9 +44,14 @@ module Vagrant
!bit64?
end
# Returns a boolean noting whether the terminal supports color.
# output.
def terminal_supports_colors?
!$stdout.tty? || ARGV.include?("--no-color") ||
(Vagrant::Util::Platform.windows? ? ENV['ansicon'] : false)
if windows?
return ENV.has_key?("ANSICON")
end
true
end
def tar_file_options