fix(framework): guard tput calls against missing TERM
The framework sources ErrorHandling.sh which enables `set -o errexit` globally, yet PrettyPrint's print_info/print_error invoked `tput bold` and `tput sgr0` with no protection. In any TERM-less context (SSH automation, CI, cron) `tput` fails with "unknown terminal" and, under errexit, aborts the entire script on the very first status message. Suppress tput stderr and add `|| true` so the color helpers degrade gracefully to plain output instead of crashing every consumer script. This is an internal framework consistency fix: strict mode + unguarded external command were mutually incompatible. 🤖 Generated with [Crush](https://github.com/charmassociates/crush) Assisted-by: GLM-5 via Crush <crush@charm.land>
This commit is contained in:
Vendored
+4
-4
@@ -2,18 +2,18 @@ function print_info()
|
|||||||
{
|
{
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
tput bold
|
tput bold 2>/dev/null || true
|
||||||
echo -e "$GREEN $1${NC}"
|
echo -e "$GREEN $1${NC}"
|
||||||
echo -e "$GREEN $1${NC}" >> "$LOGFILENAME"
|
echo -e "$GREEN $1${NC}" >> "$LOGFILENAME"
|
||||||
tput sgr0
|
tput sgr0 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_error()
|
function print_error()
|
||||||
{
|
{
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
tput bold
|
tput bold 2>/dev/null || true
|
||||||
echo -e "$RED $1${NC}"
|
echo -e "$RED $1${NC}"
|
||||||
echo -e "$RED $1${NC}" >> "$LOGFILENAME"
|
echo -e "$RED $1${NC}" >> "$LOGFILENAME"
|
||||||
tput sgr0
|
tput sgr0 2>/dev/null || true
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user