Question

  • ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32]
  • win32console (1.3.2 x86-mingw32)
  • wirble (0.1.3)
  • Windows 7

I've recently started using wirble to colorize my irb output and read that I needed to have the win32console gem to actually have color, otherwise I get color codes.

That has worked well until I noticed that my exception stack trace looked different and was missing information. I've narrowed it down to win32console.

Simple example without win32console:

irb(main):001:0> 1/0
ZeroDivisionError: divided by 0
        from (irb):1:in `/'
        from (irb):1
        from C:/ruby193/bin/irb:12:in `<main>'
irb(main):002:0>

Simple example with win32console:

irb(main):003:0> 1/0
#<Class:0x57a7598>: divided by 0
        from (irb):3:in `/'
        from (irb):3
irb(main):004:0>

Is there a way to change it back but keep the colored output?

Was it helpful?

Solution

Found out this issue has been logged before and I guess never added to the actual gem see here since the posts are four years old.

Basically change a line s = t.dup.to_s to s = t.to_s.dup in lib\Win32\Console\ANSI.rb in the def _PrintString(t) method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top