Open torokati44 opened 1 year ago
From what I can tell, Cling has hard-coded the enabling of coloring (and is using its own scheme). I've asked upstream whether there's a way of disabling it.
Yes, upstream confirms the hard-codedness. :(
I'll have to patch in in cppyy-backend. If you care about it right now, it's in CIFactory.cpp
, line 1432. Or here, from upstream: https://github.com/root-project/root/blob/master/interpreter/cling/lib/Interpreter/CIFactory.cpp#L1414
Consider this snippet (the rethrowing is just to easily redirect the error message to
stdout
):This prints out an error message like this, as expected:
It even has formatting (bold and colored text) in my terminal, which is great... ... unless the error message is supposed to appear anywhere else that is not a TTY, for example:
kdialog --msgbox "$(python3 cppyy_colordiagnostics.py)"
This results in:
As far as I'm aware, one way to disable those escape sequences is by setting this environment variable:
EXTRA_CLING_ARGS="-fno-color-diagnostics" python3 cppyy_colordiagnostics.py
However, this does nothing, the output is still colored.
Even though the flags added here do get to
clang
somehow, because it complains on unknown flags:EXTRA_CLING_ARGS="-fno-coder-diagnocchis" python3 cppyy_colordiagnostics.py
This also prints:error: unknown argument: '-fno-coder-diagnocchis'