Better error suppresion when getting terminal colours (#7739)

Co-authored-by: Richard Lyons <frob@cloudstaff.com>
This commit is contained in:
frob 2024-11-19 17:33:52 +01:00 committed by GitHub
parent 712d63c3f0
commit e66c29261a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,8 +4,8 @@
set -eu
red="$( (/usr/bin/tput bold; /usr/bin/tput setaf 1; :) 2>&-)"
plain="$( (/usr/bin/tput sgr0; :) 2>&-)"
red="$( (/usr/bin/tput bold || :; /usr/bin/tput setaf 1 || :) 2>&-)"
plain="$( (/usr/bin/tput sgr0 || :) 2>&-)"
status() { echo ">>> $*" >&2; }
error() { echo "${red}ERROR:${plain} $*"; exit 1; }