SYSTEMD_PAGER=lnav quits and prints ANSI escape code for colors on terminal
lnav version v0.13.0
Describe the bug lnav will open and quit and output will be shown on treminal with ANSI escape code text prepended.
To Reproduce Set the following variables -->
- SYSTEMD_PAGER='lnav -q'
- SYSTEMD_PAGERSECURE=false
- systemctl cat graphical.target
Instead of opening in lnav, the following gets printed on terminal -->
[phoenix@ArchLinux ~]$ systemctl cat graphical.target
# /usr/lib/systemd/system/graphical.target
⎋[0;1;38:5:245m# SPDX-License-Identifier: LGPL-2.1-or-later
⎋[0;1;38:5:245m#
⎋[0;1;38:5:245m# This file is part of systemd.
⎋[0;1;38:5:245m#
⎋[0;1;38:5:245m# systemd is free software; you can redistribute it and/or modify it
⎋[0;1;38:5:245m# under the terms of the GNU Lesser General Public License as published by
⎋[0;1;38:5:245m# the Free Software Foundation; either version 2.1 of the License, or
⎋[0;1;38:5:245m# (at your option) any later version.
⎋[0;1;38:5:245m
[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes
I don't think this is happening anymore on the top-of-tree. Unfortunately, I'm not quite sure what I did that caused the change... sigh.
This is still happening, i checked ->
-
lnav 0.13.1from github -
lnav 0.13.1-beta3-13-g26c467dfrom aur lnav-git
Ah, I think I understand now... what terminal are you using and what is TERM set to?
In the snippet you included, the escape sequence is:
[0;1;38:5:245m
lnav is expecting semi-colons and not colons for the color number (as described here -- https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit). Since it doesn't recognize the sequence, it is dumped directly to the output. It looks like colon is the truly right thing to do, so I should fix that.
Thanks for the heads up.
Okay, I'm pretty sure this is fixed now.
Yes, its fixed.
But lnav is still not being opened as pager for this command -> systemctl cat graphical.target
I am also conflicted to use lnav as a pager for systemctl command as some colors are still not being shown by lnav when output is piped to it. Systemd only provides one variable SYSTEMD_PAGER for both journalctl and systemctl commands.