Avoid subjecting variable expansions to echo -e
Also consistently use tput instead of mixing in hardcoded escape sequences.
This commit is contained in:
parent
05d36f77aa
commit
782cc4a27f
1 changed files with 7 additions and 10 deletions
17
.github/workflows/ci-scripts/docker.sh
vendored
17
.github/workflows/ci-scripts/docker.sh
vendored
|
@ -16,6 +16,7 @@ export DISPLAY=:99.0
|
|||
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24
|
||||
|
||||
red=$(tput setaf 1)
|
||||
blue=$(tput setaf 4)
|
||||
reset=$(tput sgr0)
|
||||
# print given message in red
|
||||
error() { printf '%s%s%s\n' "$red" "$*" "$reset"; }
|
||||
|
@ -25,20 +26,16 @@ die() { error "$*"; exit 1; }
|
|||
# print given message ($1) and execute given command; sets EXIT_VAL on failure
|
||||
execute() {
|
||||
local message=$1; shift
|
||||
echo
|
||||
echo -e "\e[1;34m -~=+=~- ${message//?/-}\e[0m"
|
||||
echo -e "\e[1;34mExecuting $message\e[0m"
|
||||
echo -e "\e[1;34m -~=+=~- ${message//?/-}\e[0m"
|
||||
echo
|
||||
printf '\n%s -~=+=~- %s\nExecuting %s\n -~=+=~- %s%s\n\n' "$blue" "${message//?/-}" "$message" "${message//?/-}" "$reset"
|
||||
if "$@"; then
|
||||
: # success
|
||||
else
|
||||
EXIT_VAL=$?
|
||||
echo -e "\e[1;31m********** !FAILURE! **********\e[0m"
|
||||
echo -e "\e[1;31m********** !FAILURE! **********\e[0m"
|
||||
echo -e "\e[1;31m********** !FAILURE! **********\e[0m"
|
||||
echo -e "\e[1;31m********** !FAILURE! **********\e[0m"
|
||||
echo -e "\e[1;31m********** !FAILURE! **********\e[0m"
|
||||
error '********** !FAILURE! **********'
|
||||
error '********** !FAILURE! **********'
|
||||
error '********** !FAILURE! **********'
|
||||
error '********** !FAILURE! **********'
|
||||
error '********** !FAILURE! **********'
|
||||
echo
|
||||
error "$message failed! ($*)"
|
||||
echo
|
||||
|
|
Loading…
Add table
Reference in a new issue