HomePhorge

(#12392): Colorize console output on Windows
f40cc71e8627Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

(#12392): Colorize console output on Windows

Previously, Puppet[:color] was false on Windows, because the Windows
console does not support ANSI escape sequences.

The win32console gem converts ANSI color escape sequences into Win32
console API calls to change the foreground color, etc. If the output
stream has been redirected to a file, then the gem does not translate
the sequences, instead preserving them in the stream, as is done on
Unix.

To disable colorized output specify color=false or --color=false on
the command line.

This commit adds a Puppet.features.ansicolor? feature that defines
whether ANSI color escape sequences are supported. On Windows, this is
only true if the win32console gem can be loaded. On other platforms, the
value is always true.

The win32console gem will be packaged into the Windows installer, and
so, Puppet[:color] now defaults to true. If the gem can't be loaded,
then puppet will revert to its previous behavior.

Details

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPUf40cc71e8627: (#12392): Colorize console output on Windows (authored by Josh Cooper <josh@puppetlabs.com>).Apr 16 2012, 8:41 PM