Bug 67656

Summary: systemd-delta: Only colorize when on tty
Product: systemd Reporter: Daniel Schaal <farbing>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch: only colorize output when on tty
Remade patch without macros

Description Daniel Schaal 2013-08-02 08:20:31 UTC
Created attachment 83508 [details]
Patch: only colorize output when on tty

Currently systemd-delta always puts highlighting escape codes in the output, even if the output is redirected to a file.

Attached is a patch, which checks if the output is a tty and disables the highlighting if this is not the case.
Comment 1 Zbigniew Jedrzejewski-Szmek 2013-08-03 19:53:11 UTC
Idea is OK. Could you remake the patch to not use macros (similar coloring issues were solved in journalctl.c or systemctl.c)?
Comment 2 Daniel Schaal 2013-08-04 07:47:10 UTC
Created attachment 83605 [details] [review]
Remade patch without macros
Comment 3 Zbigniew Jedrzejewski-Szmek 2013-08-04 12:34:24 UTC
Pushed as http://cgit.freedesktop.org/systemd/systemd/commit/?id=0b5a519,
but changed to share the on_tty() wrapper between the three places where it is necessary. Thanks for the patch.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.