Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leftover ANSI color/style sequence in piped output #145

Open
joelpurra opened this issue Oct 31, 2020 · 0 comments
Open

Leftover ANSI color/style sequence in piped output #145

joelpurra opened this issue Oct 31, 2020 · 0 comments
Labels

Comments

@joelpurra
Copy link

Since #5, there should be no colorization if the output is piped (as in "not a TTY") from rainbow to another command. There still seems to be leftover ANSI escape codes at the end of the output though. See also #128 for forcing colorized output.

Tested using rainbow v2.7.1 on Linux, using hexdump to verify the bytes.


Plain echo without rainbow, piped to hexdump.

echo 'abc' | hexdump -c
0000000   a   b   c  \n                                                
0000004

With pipe from rainbow without any color filters, piped to hexdump.

Note the four added "reset" bytes, ESC[0m.

rainbow echo 'abc' | hexdump -c
0000000   a   b   c  \n 033   [   0   m                                
0000008

With pipe from rainbow, with one color filter, piped to hexdump.

Note that the color filter is not applied, as per #5. Colorization can be forced using (the workaround in) #128.

rainbow --red 'b' echo 'abc' | hexdump -c
0000000   a   b   c  \n 033   [   0   m                                
0000008
@nicoulaj nicoulaj added the bug label Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants