mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-08 13:46:39 +02:00
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:
parent
5df0eab4fa
commit
c2474ae596
10
common.sh
10
common.sh
@ -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
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user