Thursday, July 14, 2016

Cygwin and ANSI terminal

Problem

I see ANSI color sequences on Cygwin.

Explanation

The default Cygwin.bat runs bash in a Window terminal, which does not support ANSI sequences, so you'll see the color codes instead of actual colors:

$ codecept selfupdate

[37;41m                                                                   [39;49m
[37;41m  [Symfony\Component\Console\Exception\CommandNotFoundException]   [39;49m

Solution

Edit the Cygwin.bat and make it look like:

@echo off

C:
chdir C:\cygwin64\bin

mintty -

Now, it will run "mintty", which is a different terminal, and it will show the colors correctly.
(Be prepared for the possible changes in copy/paste with mouse clicks).