[Rspec-devel] --colour : Windows complications

David Chelimsky dchelimsky at gmail.com
Fri Sep 8 10:22:20 EDT 2006


On 9/8/06, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> 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.

Works on OS X fine. Hack is hack-ish - but it's a text formatter class
that deals generally w/ console output, so it's as good a place for it
as any.

Nice work on this Aslak.
David

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


More information about the Rspec-devel mailing list