lib/bash: make call to tput more robust
Specifically, if `tput colors` fails with an error we treat that as if the terminal does not support colors. Fixes #423 Suggested-by: PhotonQuantum <self@lightquantum.me>
This commit is contained in:
parent
8eaa3ba56e
commit
8cbc6500df
|
@ -23,7 +23,7 @@ function setupColors() {
|
||||||
if [[ ! -v NO_COLOR && -t 1 ]]; then
|
if [[ ! -v NO_COLOR && -t 1 ]]; then
|
||||||
# See if it supports colors.
|
# See if it supports colors.
|
||||||
local ncolors
|
local ncolors
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors 2> /dev/null || echo 0)
|
||||||
|
|
||||||
if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then
|
if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then
|
||||||
normalColor="$(tput sgr0)"
|
normalColor="$(tput sgr0)"
|
||||||
|
|
Loading…
Reference in a new issue