From d71ff0560b26d002ef1bae6f479a04b118137dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Gilbert?= Date: Mon, 20 Nov 2023 13:00:56 +0100 Subject: [PATCH] ci-wrapper: prevent piping from disabling automatic colors Replace PR #18337 --- dev/ci/ci-wrapper.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/ci/ci-wrapper.sh b/dev/ci/ci-wrapper.sh index 654475338d66b..ad824b60f9270 100755 --- a/dev/ci/ci-wrapper.sh +++ b/dev/ci/ci-wrapper.sh @@ -14,7 +14,12 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "${DIR}/../.." || exit 1 export TIMED=1 -bash "${DIR}/${CI_SCRIPT}" 2>&1 | tee time-of-build.log +if [ -t 1 ] && command -v script > /dev/null; then + # prevent piping from disabling auto colors + script --quiet --flush --return -c "bash '${DIR}/${CI_SCRIPT}'" /dev/null 2>&1 | tee time-of-build.log +else + bash "${DIR}/${CI_SCRIPT}" 2>&1 | tee time-of-build.log +fi code=$? echo 'Aggregating timing log...' python ./tools/make-one-time-file.py time-of-build.log