Please review pull request #776: (Maint) Color console output when the win32console gem is installed opened by (joshcooper)
Description:
Originally, we were using a feature to detect whether the platform
supports ANSI color escape sequences. The feature used to invokePuppet.features.rubygems?, which had the side-effect of loading
rubygems, if it hadn't already been loaded.
However, the ansicolor feature could cause infinite recursive loops when
trying to log that it failed to load the ansicolor feature. So the code
for loading the win32console gem was moved into Puppet::Util::Colors in
commit 91a4a7d.
However, in doing so, rubygems was not being loaded when attempting torequire 'win32console', causing Windows to always raise a LoadError,
even when the win32console gem was installed.
This commit adds an explicit call to require rubygems and now correctly
colors console output when the win32console gem is installed.
- Opened: Mon May 14 20:52:13 UTC 2012
- Based on: puppetlabs:2.7.x (ab8cd8be002ea0e8dd72bdb8f0ef740e5546a6b1)
- Requested merge: joshcooper:maint/2.7.x/fix-broken-console-color (ead9d254da57f43b18ac7e261eb9a95f4a9399cf)
Diff follows:
diff --git a/lib/puppet/util/colors.rb b/lib/puppet/util/colors.rb
index 5c74cc9..7c5840a 100644
--- a/lib/puppet/util/colors.rb
+++ b/lib/puppet/util/colors.rb
@@ -82,6 +82,7 @@ module Puppet::Util::Colors
if Puppet::Util::Platform.windows?
# We're on windows, need win32console for color to work
begin
+ require 'rubygems'
require 'win32console'
rescue LoadError
def console_has_color?
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
