common.sh: tweak color order for set -x love

If you trace any script with `set -x` enabled, bash will dump the color
variables and all of your output will be colored.  So move the "reset"
color to last so that the bleeding is localized to a few lines rather
than a few hundred.  There should be no functional difference.

BUG=None
TEST=ran setup_board with and w/out -x to create x86-generic to check result

Change-Id: I1e598cc4a38e9f217f2f670a00bd676bf70c2338
Reviewed-on: http://gerrit.chromium.org/gerrit/5804
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2011-08-11 18:27:44 -04:00
parent 5df0eab4fa
commit c2474ae596

View File

@ -220,18 +220,20 @@ FACTORY_INSTALL_MASK="
"
# Determine and set up variables needed for fancy color output (if supported).
V_REVERSE=
V_VIDOFF=
V_BOLD_RED=
V_BOLD_GREEN=
V_BOLD_YELLOW=
V_REVERSE=
V_VIDOFF=
if tput colors >/dev/null 2>&1; then
V_REVERSE="$(tput rev)"
V_VIDOFF="$(tput sgr0)"
# order matters: we want VIDOFF last so that when we trace with `set -x`,
# our terminal doesn't bleed colors as bash dumps the values of vars.
V_BOLD_RED="$(tput bold; tput setaf 1)"
V_BOLD_GREEN="$(tput bold; tput setaf 2)"
V_BOLD_YELLOW="$(tput bold; tput setaf 3)"
V_REVERSE="$(tput rev)"
V_VIDOFF="$(tput sgr0)"
fi
# -----------------------------------------------------------------------------