On Wed, Mar 10, 2010 at 2:35 AM, Luis Lavena <luislavena / gmail.com> wrote:

> =3D=3D=3D=3D
>
> Stops there, all without colors.
>
> Now, running rake spec or spec -c spec display all colors too, so is
> something around autospec/autotest and Ruby 1.9
>
> =3D=3D=3D=3D
>
> Hope I explained better this time since seems nobody answered on RSpec-
> dev maybe my english wasn't good enough.
>

Ah! I see the problem now.  I'm afraid it is in win32console[1], and
I'm afraid I wrote it.
This code will reproduce the bug:

ruby -e "require 'rubygems'; require 'win32console'; %Q{\e[31mred\e[0m
\e[32mgreen\e[0m}.each_byte{|i| putc
i }"

ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]
red green
 # in color

ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
red green
 # in color

ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
=1B[31mred=1B[0m =1B[32mgreen=1B[0m

Autotest uses getc to read from stdout, and putc to write to it.  I
redefined Kernel#putc to cache escape codes and write them all at
once.  Otherwise, win32console won't work.  The problem in 1.9 is that
"?\e" doesn't return the byte value, but the string.  I'll submit a
patch.


[1] http://github.com/luislavena/win32console/blob/master/lib/Win32/Console=
/ANSI.rb#L103

> Regards,
> --
> Luis Lavena
>
>