From aa765005e8a4c9710d90e3a02484bec28da496eb Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Fri, 22 Dec 2017 11:28:13 +0100 Subject: [PATCH] doc/scripts/filter-doc-log: protect further against bad TERM env Checking for TERM being undefined before doing tput with colors is not enough; if TERM is defined as 'dumb', this thing also behaves dumbly. In fact, the whole trying to do colors thing is dumb and causes all kinds of headache in corner cases, so just wrap anything smelling like color in a check for TERM being undefined or 'dumb' and be done with it. It shall take care of different automation mechanisms that don't invoke 'make htmldocs' from a user console. Signed-off-by: Inaky Perez-Gonzalez --- doc/scripts/filter-doc-log.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/scripts/filter-doc-log.sh b/doc/scripts/filter-doc-log.sh index 3c2cca880d6..37cf5f90688 100755 --- a/doc/scripts/filter-doc-log.sh +++ b/doc/scripts/filter-doc-log.sh @@ -11,9 +11,6 @@ CONFIG_DIR=${ZEPHYR_BASE}/.known-issues/doc LOG_FILE=$1 -red='\E[31m' -green='\e[32m' - if [ -z "${LOG_FILE}" ]; then echo "Error in $0: missing input parameter " exit 1 @@ -21,10 +18,14 @@ fi # When running in background, detached from terminal jobs, tput will # fail; we usually can tell because there is no TERM env variable. -if [ -z "${TERM:-}" ]; then +if [ -z "${TERM:-}" -o "${TERM:-}" = dumb ]; then TPUT="true" + red='' + green='' else TPUT="tput" + red='\E[31m' + green='\e[32m' fi if [ -s "${LOG_FILE}" ]; then