From: "John G." Date: 2010-10-25T17:10:56+09:00 Subject: win32console changes Windows cmd.exe colors A problem has occurred with Windows Vista64 rspec since I upgraded to rspec 2.0.1 and others. Before the upgrade, even with win32console installed 'C> rspec spec' showed escape codes, but 'rspec spec | cat' (using cygwin/bin/cat/) showed colors fine--so I was happy. Now rspec shows colors without having to pipe to cat, but the text output is red/green/grey-on-black, regardless of my cmd.exe color properties, and cmd.exe colors get changed to grey-on-black. Besides having to change the colors back after rspec, red-on-black rspec text is not easy to read. --------------------------------------- Why do I blame win32console(1.3.0)? My thanks to Gordon Thiesfeld in post http://www.ruby-forum.com/topic/205569 for the following test case: --------------------------------------- 1) Open a Windows cmd console, presumably not a black background, otherwise change by (say) 'color f0' (black on white). Execute . C> ruby -e "require 'rubygems'; require 'win32console'; %Q{\e[31mred\e[0m\e[32mgreen\e[0m}.each_byte{|i| putc i }" . Note the red-green output on a black background, and subsequent typing is grey-on-black. Reset the colors by executing 'color f0'. . 2) Now output the escape codes without 'require win32console': . C> ruby -e "%Q{\e[31mred\e[0m\e[32mgreen\e[0m }.each_byte{|i| putc i}" . Escape-codes are shown instead of colors, but cmd-window colors remain black-on-white. Some may deem this inferior to the previous result, but note that (using something like cygwin/bin/cat)... . C> ruby -e "%Q{\e[31mred\e[0m\e[32mgreen\e[0m hello}.each_byte{|i| putc i }" | cat . Yields a perfect red-green output and does not affect cmd-window colors. Far superior since rspec is usually executed from the command-history buffer. However, would it be possible to fix this issue so that a) cmd-window properties are not affected and b) cat is not needed, like now? -- Posted via http://www.ruby-forum.com/.