mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 09:29:41 +08: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:
@@ -23,7 +23,7 @@ function setupColors() {
|
||||
if [[ ! -v NO_COLOR && -t 1 ]]; then
|
||||
# See if it supports colors.
|
||||
local ncolors
|
||||
ncolors=$(tput colors)
|
||||
ncolors=$(tput colors 2> /dev/null || echo 0)
|
||||
|
||||
if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then
|
||||
normalColor="$(tput sgr0)"
|
||||
|
||||
Reference in New Issue
Block a user