How do I keep the *colorized* output result of a command when printing the result of a command in Ruby?

StackOverflow https://stackoverflow.com/questions/7259993

  •  17-01-2021
  •  | 
  •  

문제

Here's the thing:

I run a bunch of Cucumber tests from a ruby file by calling the command like this:

result = `bundle exec cucumber tests/specs/features`
[...] # do stuff with it
puts result

Now the result of the command has these nice colors telling me a lot about passing and failing tests by just looking at it without reading. But: when I put the result like this, the coloring is gone!

Is there any way of doing this without losing the coloring?

도움이 되었습니까?

해결책

Take a look at this and this questions, they are about just the same thing but with rspec instead of cucumber.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top