Check if the output is a tty

The color code should not be emitted if the stdout is not a typical terminal, we add the check so there is no need to explictly specify `--stdout`
This commit is contained in:
yxnan 2022-10-27 00:27:23 +08:00 committed by GitHub
parent 0dae7ca3f9
commit 23a1b10467
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13702,6 +13702,9 @@ main() {
get_distro get_distro
get_bold get_bold
get_distro_ascii get_distro_ascii
# check if the output is a interactive terminal
[[ -t 1 ]] || stdout=on
[[ $stdout == on ]] && stdout [[ $stdout == on ]] && stdout
# Minix doesn't support these sequences. # Minix doesn't support these sequences.