[Rspec-devel] --colour : Windows complications

aslak hellesoy aslak.hellesoy at gmail.com
Fri Sep 8 10:11:53 EDT 2006


On 9/8/06, DeeJay <smartgpx at gmail.com> wrote:
>
> "  It looks like
>
> STDOUT.puts
> and
> puts
>
> Don't behave the same way with win32console . "
>
> I'm slower on the uptake, but had reached a similar conclusion, demonstrated
> here -
>
> ===
>
>
>
> require 'Win32/Console/ANSI'
>
> @works = $stdout
> @works << "\e[31m" << "RED" << "\e[32m" << "GREEN" << "\e[0m" << "normal" <<
> "\n"
>  @fails = STDOUT
> @fails << "\e[31m" << "RED" << "\e[32m" << "GREEN" << "\e[0m" << "normal" <<
> "\n"
>
>
> ===
>
>
> Changing the default output stream from STDOUT to $stdout breaks other
> things, but doesn't fix this.
>
> Looking in the win32console library, at the end of ../Win32/Console/ANSI.rb,
> it is a new $stdout that
> gets returned, which is an  IO with its own  'write' method. So it seems
> STDOUT << 'string' doesn't
> go through win32console at all.
>

I just committed a fix so this should now work on windows (I hope I
didn't break native support on osx/linux). It's a hack in
base_text_formatter.rb. A little ugly but it works.

Aslak

>
> DeeJay
>
>
>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>
>


More information about the Rspec-devel mailing list