Bug 67656 - systemd-delta: Only colorize when on tty
Summary: systemd-delta: Only colorize when on tty
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-02 08:20 UTC by Daniel Schaal
Modified: 2013-08-04 12:34 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch: only colorize output when on tty (2.52 KB, text/plain)
2013-08-02 08:20 UTC, Daniel Schaal
Details
Remade patch without macros (2.87 KB, patch)
2013-08-04 07:47 UTC, Daniel Schaal
Details | Splinter Review

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.