From 8cbc6500dfca22d907054f68c564019b3b6cf295 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 13 Oct 2022 11:11:42 +0200 Subject: [PATCH] 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 --- lib/bash/home-manager.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bash/home-manager.sh b/lib/bash/home-manager.sh index c7ff5c344..b7f3f42b2 100644 --- a/lib/bash/home-manager.sh +++ b/lib/bash/home-manager.sh @@ -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)"