grosser / autotest

Save a file, autotest will run the matching tests! (Autotest without ZenTest)
121 stars 20 forks source link

[Windows] Colouring in console is broken #5

Closed charlesroper closed 13 years ago

charlesroper commented 14 years ago

Autotest is not starting win32console on Windows and so it renders a bunch on escape codes to the screen instead of colours. Rspec handles it like this:

http://github.com/dchelimsky/rspec/blob/master/lib/spec/runner/options.rb#L187

While in Rails itself, I add the following to config/environments/development.rb:

http://gist.github.com/306678

voxik commented 14 years ago

Actually the problem comes from this commit http://github.com/grosser/autotest/commit/d827a4a5004ae3d89be45b61422ad500c79d4f52 where the putc was replaced by print. When you replace it back, the coloring will work. I have no idea for what purpose it was changed ...

lstoldt commented 14 years ago

I also have this problem and changing print to putc fixed it for me.

luislavena commented 14 years ago

The problem about using print vs putc is because print fixes the output of UTF strings, something that getc will actually corrupt from input (try pass specs with accented characters in it).

Either way, please see the RubyInstaller thread about deprecating win32console support:

http://groups.google.com/group/rubyinstaller/browse_thread/thread/2d2a62db7281509a/

daniel commented 13 years ago

Does this bug effect other OSes? I get no colours in Debian (but I do in Mac OS X).

luislavena commented 13 years ago

It could, that depends on your current encoding of the terminal and the version of Ruby you're using.

For example, usage of accented characters inside autotest could generate broken output due the usage of getc to get a single byte and usage of print to output it.

grosser commented 13 years ago

the original change was a refactoring for more readability, i reverted this and added a comment (how to test this ?)

luislavena commented 13 years ago

You need Windows :P

But basically using putc with single characters (like it used to do) should fix this.