Get ANSI-colored output from external command
Posted
by
German Rumm
on Stack Overflow
See other posts from Stack Overflow
or by German Rumm
Published on 2012-06-24T14:23:37Z
Indexed on
2012/06/24
15:16 UTC
Read the original article
Hit count: 233
ruby
|ansi-colors
I am writing a small script for watchr
that runs my PHP unit tests.
Current script runs tests using system()
and displays them colored.
I am trying to add libnotify
functionality, but for that I need to parse the output and match against regexp, so that notification will either display green or red.
system()
doesn't return output, %x
does return, but puts p
doesn't display colors, which I need to quickly see which test failed. One option would be to run tests twice - once for display in terminal window, and second time for checking which notification to show, but I would rather avoid it.
© Stack Overflow or respective owner