follow me icons

Monday, February 21, 2011

How to install ansicon for cucumber to get coloured output on Windows

Last week, I have just upgraded my cucumber gem from 0.6.4 into 0.10.0 as the documentation says that the new gem from 0.7 onward should be able to parse the gherkin text 50-100 times faster.

However, after I upgraded to version 0.10.0, I get the following warning

*** WARNING: You must use ANSICON 1.31 or higher 
(http://adoxa.110mb.com/ansicon) to get coloured output on Windows


I actually like the win32console better than this as you can just put the win32console gem into your gemfile so you don't have to install ansicon separately.

Anyway, here are the steps on how to install ansicon.exe:

1. Download and unzip the file from https://github.com/adoxa/ansicon/downloads
2. open cmd and navigate to the unzipped folder
3. Navigate to x64 (if you have a 64 bit machine) otherwise navigate to x86
4. Type ansicon.exe -h and you will get the following:
D:\Data\ansicon\x86>ansicon.exe -h
ANSICON by Jason Hood .
Version 1.32 (22 December, 2010).  Freeware.
http://ansicon.adoxa.cjb.net/

Process ANSI escape sequences in Win32 console programs.

ansicon -i|I | -u|U
ansicon [-m[]] [-p | -e|E string | -t|T [file(s)] | program [args]]

  -i            install - add ANSICON to the AutoRun entry (implies -p)
  -u            uninstall - remove ANSICON from the AutoRun entry
  -I -U         use local machine instead of current user
  -m            use grey on black ("monochrome") or  as default color
  -p            hook into the parent process
  -e            echo string
  -E            echo string, don't append newline
  -t            display files ("-" for stdin), combined as a single stream
  -T            display files, name first, blank line before and after
  program       run the specified program
  nothing       run a new command processor, or display stdin if redirected

 is one or two hexadecimal digits; please use "COLOR /?" for details.
5. Execute 'ansicon.exe -i' to install and add ansicon to your Windows
6. Run your cucumber 0.10.0 test and you should 
get the coloured output result on Windows

13 comments:

  1. Cheers, great blog sorted out my rspec colours.

    ReplyDelete
  2. ANSICon is a great tool - and without the security issues that ansi.sys had (keyboard remapping).

    ReplyDelete
  3. Why does it says "ansicon is not recognized as an internal or external command"?

    ReplyDelete
  4. .exe does not appear to be included in download of v1.53 (Need to compile your own?)

    ReplyDelete
  5. .exe does n ot appear to be part of v1.53 download.

    Now need to compile your own locally?

    ReplyDelete
  6. v1.53 from github goes not contain the executable, but v1.52 does.

    ReplyDelete
    Replies
    1. I tried downloading it just now and I can see the ansicon.exe file under the folder x86 and x64.

      https://github.com/downloads/adoxa/ansicon/ansi153.zip

      Anyway, it's good that you get it working with 1.52

      Delete
  7. I'm sorry you lost me on the navigate to x64 line? There's no such directory in the ansicon-master folder

    ReplyDelete
    Replies
    1. The ansicon folder is located at

      ansi153/x64 - for 64 bit machine
      ansi153/x86 - for 32 bit machine

      Delete
  8. I do not recommend doing the -h step with the latest version - it does not give the output shown above, just launches a new shell inside your shell. Not useful.

    ReplyDelete
  9. what should we do instead

    ReplyDelete
  10. "ansicon.exe -i" does nothing and keeps the screen idle not installing anything.

    ReplyDelete