mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
script/check-config: disable colors
...when the stdout is not a terminal, and also when NO_COLOR environment variable is set to any non-empty value (as per no-color.org). Co-authored-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e -u
|
||||
|
||||
[ -t 1 ] || NO_COLOR=1
|
||||
|
||||
# bits of this were adapted from check_config.sh in docker
|
||||
# see also https://github.com/docker/docker/blob/master/contrib/check-config.sh
|
||||
|
||||
@@ -43,6 +45,8 @@ is_set_as_module() {
|
||||
}
|
||||
|
||||
color() {
|
||||
[ -n "${NO_COLOR:-}" ] && return
|
||||
|
||||
local codes=()
|
||||
if [ "$1" = 'bold' ]; then
|
||||
codes=("${codes[@]-}" '1')
|
||||
|
||||
Reference in New Issue
Block a user