Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANSI control codes on Windows #64

Closed
charlesroper opened this issue Dec 8, 2009 · 3 comments
Closed

ANSI control codes on Windows #64

charlesroper opened this issue Dec 8, 2009 · 3 comments
Labels

Comments

@charlesroper
Copy link

The CLI utilities are spitting out ANSI control codes on Windows instead of rendering colours.

http://pastie.org/733822

This is easy to solve by detecting for windows:

http://blog.emptyway.com/2009/11/03/proper-way-to-detect-windows-platform-in-ruby/

Then requiring win32console.

e.g.

require 'rbconfig'
require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/

(note I've used RbConfig::CONFIG rather than Config::CONFIG - this is, apparently, because Config::CONFIG is being remove from Ruby.)

@chriseppstein
Copy link
Member

I thought this might happen. thanks for the platform detection tips, But I think this is more about the terminal than the OS. I need to figure out if there's an ansi capable terminal to do this correctly.

In the meantime, you can turn off the colors by adding color_output = false to your configuration.

@charlesroper
Copy link
Author

Not sure if this helps at all, but I just tested and it does actually work if you require win32console...

http://i.imgur.com/aK05X.png

@chriseppstein
Copy link
Member

Make ANSI color output work on windows. Closed by 38ff0b7.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants