Skip to content

Commit 6072ed9

Browse files
committed
src/main/scripts: fix displaying of colors.
$ sh -c 'echo "\033[1;32mSUCCESS\033[0m"' SUCCESS $ bash -c 'echo "\033[1;32mSUCCESS\033[0m"' \033[1;32mSUCCESS\033[0m Also use `printf` instead of `echo -e` to make scripts work on MacOS. Correction for f296397 commit. Addressed to #351
1 parent ac4586c commit 6072ed9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/scripts/ci/common.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
print_status() {
22
local we_failed="$1"
33
local msg="$2"
4+
local status='SUCCESS'
45

5-
printf "* $msg... "
66
if [ -n "$we_failed" ]; then
7-
echo "\033[1;31mFAIL\033[0m"
8-
else
9-
echo "\033[1;32mSUCCESS\033[0m"
7+
status='FAIL'
108
fi
9+
printf "* %s... \033[1;32m%s\033[0m\n" "$msg" "$status"
1110
}
1211

1312
print_log() {
1413
local log_file="$1"
1514
local msg="$2"
1615

1716
echo
18-
echo "=====> \033[1;33m$msg\033[0m"
17+
printf "=====> \033[1;33m%s\033[0m\n" "$msg"
1918
echo
2019
egrep -v '^\[INFO\] Download(ing|ed):' "$log_file"
2120
}

0 commit comments

Comments
 (0)