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