grc icon indicating copy to clipboard operation
grc copied to clipboard

"colourify env" is disruptive in case `env` is used to run a command

Open levitsky opened this issue 3 years ago • 2 comments

grc colorizes the output of env. This works fine when env is used to print out the environment variables, but its primary objective is different: to run an external command in a modified environment.

In case env runs a command, it does not make sense to parse the output according to the regex configured. Also, it breaks pagers and any other kind of interactivity because of the redirection it does.

In my specific case, I was using this profile that colorized man pages (a task similar to that of grc) and grc broke it because man pages were not paged inside env because of the redirects happening due to env being aliased to a grcat call with redirects. This is undesirable and hard to debug (I was confused and had to seek help).

I think the rule for env should either restrict to the case when no external command is run (which is hard to do) or not touch env at all. The current behavior is disruptive.

P.S. Thank you for making and supporting this tool! I've been using it for years.

P.P.S. BTW, this problem only surfaced in the last version because /etc/profile.d/grc.bashrc was renamed to grc.sh. Before that, it wasn't sourced and all those aliases were not applied for me.

levitsky avatar May 13 '21 22:05 levitsky

For that matter, journalctl behavior is also broken because it pages its output normally (and also partially colorizes it), at least on my system.

levitsky avatar May 15 '21 19:05 levitsky

This was fixed on 6f0a553c76149001fc837c07be8f9898b6bf39ac I think

iax7 avatar Dec 21 '21 05:12 iax7