Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber: pipe output without losing color

I'm using cucumber to run some tests. It colorizes its output using ANSI escapes. This is great, but currently its producing more output than I care about, and shoving things I do care about off the screen. There doesn't seem to be a way to eliminate the other lines from within cucumber, but I can pipe the output through grep to pare down to the ones I care about.

The downside of this solution, though, is that all the colors are lost. I know it's not my shell or grep's fault, because % echo "\e[35mhello\e[00m world" | grep hello works just fine, so it must be cucumber disabling its own color somehow.

How can I preserve the colored output when I pipe the output of cucumber?

like image 989
rampion Avatar asked Sep 24 '10 18:09

rampion


1 Answers

Doh. It's covered in cucumber -h. Use the -c flag to force colorized output.

like image 172
rampion Avatar answered Sep 25 '22 14:09

rampion