1

I'm running:
+ Ruby 1.9.2p290
+ Rails 3.1.1
+ Rspec 2.6.0
+ autotest 4.4.6
+ ansicon 1.40
+ spork
+ growl
on Windows Vista 64-bit to go through the rails 3 tutorial. The tests seem to run fine and I get the expected output--except coloring. The output from autotest is in color. If I run rspec alone as rspec spec/ I get escape sequences printed rather than color. Other rails tools also vary on whether they display in color or escape sequences. Any suggestions?

George Shaw
  • 1,771
  • 1
  • 18
  • 32
  • Did you try `rspec --color` ? – zetetic Nov 08 '11 at 00:44
  • Yes, it is set in the `.rspec` file, and that is presumably why the escape sequences are being sent. I also tried `--no-color` and the escape sequences are no longer sent, so the switch works properly. I get no message about not finding `ansicon`, but `ansicon` is not trapping the escape sequences and creating colored text. – George Shaw Nov 08 '11 at 14:45

2 Answers2

1

After rechecking everything and lots more research, I could find nothing that should keep ansicon from trapping the color sequences. The only requirement on ansicon is that it be located in PATH. I'd placed it in c:\windows\system32 since that is always in PATH, however, it is about 10 items down the list. One thought is that some Rails apps are not searching that far. I copied the ansicon files to C:\RailsInstaller\Ruby1.9.2\bin that is at the top of PATH, and now it works all the time.

I suspect that some Rails apps have trouble with items in PATH, possibly spaces in the pathnames (such as "Program Files") or other such differences between Linux and Windows that sometimes choke programs.

George Shaw
  • 1,771
  • 1
  • 18
  • 32
  • When you say you copied the ansicon files to the *\ruby1.9.2\bin, which files exactly? did you move the whole directory you u unzipped? did you also leave the fiels in system32? also, how did you install ansicon? did you use "asnsicon.exe -i"? – E.E.33 Jan 19 '12 at 08:42
  • 1
    The `ansicon` executable files to copy are either the contents of the `x86` (for 32-bit Windows) or the `x64` (for 64-bit wiWindows)directory depending on your system. The other files in the ZIP are the source and are not needed for execution. I did not leave the executables in system32. IIRC there are documented possible incompatibilities when using `ansicon -i` so I use a batch file that changes directory to my project, executes `ansicon` (no -i), etc. when I open a Ruby DOS console window to work. – George Shaw Jan 19 '12 at 17:25
  • awesome! I also had to setup a variable enviornment: ANSICON_EXC = nvd3d9wrap.dll in order for it work on my system. Windows 7 64bit – E.E.33 Jan 20 '12 at 02:59
  • What was the problem you noticed that using ANSICON_EXE fixed, and how did you know what to set it to? – George Shaw Jan 20 '12 at 16:38
  • On Windows 7 people have been experiencing all command line actions involving interpreters crashing after starting ansicon. Also Ansicon itself stops working if you run any commands. This is due to a conflict that occurs when ansicon trys to hook into a certain Nvidia library apparently. Setting this system variable excludes the library from the hooking process. I got the info from here >> https://github.com/adoxa/ansicon/issues/14 - thanks for the help George Shaw – E.E.33 Jan 20 '12 at 18:39
  • Hey George, how can I see what your batch file looks like that automates your ansicon environment? I'm not good at programming batch files. I just wan't it to auto run aniscon and cd to my workspace directory. – E.E.33 Jan 21 '12 at 17:42
  • Opening a Ruby console leaves the system in `c:\sites`, so I place the batch file there. I'm currently keeping the data on a USB key that is mounted as i: (so I can instantly remove the key and move to my laptop when needed) so I switch to the i: drive first. `i: cd ansicon -p` The `-p` keeps `ansicon` from nesting another command shell. – George Shaw Jan 21 '12 at 21:51
  • 1
    I can't seem to get any formatting in the comment. The batch file is three lines. `i:` on one, the `cd` on the second, and the `ansicon -p` on the third. Sorry about that. – George Shaw Jan 21 '12 at 22:03
0

Most Ruby tools have problems with spaces in PATH. Therefore, try putting ansicon at the front of the entire PATH before everything else -- especially those with C:\Program Files\....

shaolang
  • 995
  • 11
  • 25