Michal Koutný changed bug 1218106
What Removed Added
Flags needinfo?(systemd-maintainers@suse.de)  

Comment # 13 on bug 1218106 from Michal Koutný
(In reply to Ancor Gonzalez Sosa from comment #8)
> I did more experiments and SYSTEMD_LOG_COLOR seems to be irrelevant for this.

Right. (It's a gotcha since it applies to log-level coloring, not JSON
coloring.)

> which is not the case in YaST (we are executing the command and
> parsing the output).

I was previously focused on the env variables but the coloring based on
tty/nontty output works for me. (Curiously, I don't see any recent changes in
this area.)

systemd-249.16-150400.8.35.5.x86_64
systemd-254.5-8.1.x86_64


(In reply to Stefan Hundhammer from comment #12)
> The purpose of JSON is to be machine-readable, and escape
> sequences pretty much defeat that.

The reading machine parses a pipe or a saved file and those should be without
color escapes. (The logic [1] should boil down to isatty(3).)

Is it possible that something adds SYSTEMD_COLORS > 0 to the environment?
(The variable seems to override tty detection.)


[1]
https://github.com/openSUSE/systemd/blob/071ac409a0564863657d8f8a5a35e6a4f914695f/src/basic/terminal-util.c#L1336


You are receiving this mail because: