That's a pretty weird title but I'm having trouble articulating this question:
When I run kitty --version
in my terminal it prints its version out to stdout, however the text is styled and colored:
In order to achieve this the process had to output ANSI escape codes to stdout, however I don't see them when I hexdump the output:
$ kitty --version | xxd -g 1 -c 10 -u
00000000: 6B 69 74 74 79 20 30 2E 31 39 kitty 0.19
0000000a: 2E 31 20 63 72 65 61 74 65 64 .1 created
00000014: 20 62 79 20 4B 6F 76 69 64 20 by Kovid
0000001e: 47 6F 79 61 6C 0A Goyal.
I'd expect to see at least a few escape characters and other ANSI sequences here but I don't. This leads me to believe that kitty
is able to "predict" whether its output will appear in a terminal that can process the escape codes.
How is it able to do that? Or is it a feature of the terminal emulator perhaps?
Read man isatty
, or https://linux.die.net/man/3/isatty
isatty - test whether a file descriptor refers to a terminal
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments