mirror of
https://github.com/nix-community/home-manager
synced 2024-12-19 08:19:48 +01:00
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
1 changed files with 1 additions and 1 deletions
|
@ -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