ANSI Escape in Console

Add this URL to your Eclipse Installation to reach this solution's update site.

Mars (4.5)
Luna (4.4)
Kepler (4.3)
Juno (4.2, 3.8)
Previous to Juno (<=4.1)
Neon (4.6)
Oxygen (4.7)

Learn more...

Details Group Tabs

hsengupta's picture

Cannot Install. Facing error
"Unable to read repository at http-www mihai-nita net -eclipse-content xml
peer not authenticated"

Can anyone look into this Please..

vmisingnamekvr's picture

Hi, is it possible to turn on also ANSI-coloring during build in build console for ROS groovy projects?
For some reason it is not ANSI-colored here (Eclipse 4.4)

mnita's picture

Sorry, I don't have an Ubuntu installed (just Win and Fedora).
I have found a VM, and I can try that.

But a quick look at the sources finds this "suspicious" line in catkin_make and catkin_prepare_release:

# force --no-color if stdout is non-interactive
if not sys.stdout.isatty():
    args.no_color = True

Since Eclipse needs to capture its output, it starts the build with the stdio and stderr redirected.
And that makes sys.stdout.isatty() return False (because the Eclipse console is not really a terminal).

It looks like there is no way to get around this without code changes.
But you can just comment these two lines and it should work.

If you are on Windows, the also needs some fixing, because it assumes that Windows cannot support ANSI escapes (not true):

if in ['nt']:

The way I would fix ROS "for real" would be by adding a --force-color flag
(or do what most posix apps do: --color=never|always|auto and also honor an environment variable)

Anyway, if commenting the "if not sys.stdout.isatty():" does not work, please let me know, and I will go ahead and try top setup a working ROS environment.

Thank you,

mnita's picture

I don't know, I have never played with ROS. Let me give it a try, and will get back to you.
Thank you!

pverest's picture

Just look at picture and try to recall all those ANSI codes...