Skip to content
Permalink
Browse files

[docker] Avoid assuming /dev/tty is usable

Closes #36187
  • Loading branch information
strk committed May 5, 2020
1 parent aaed8f4 commit ef0bfff02272fe461eab9a7719872859dcb0b4b4
Showing with 10 additions and 1 deletion.
  1. +10 −1 .docker/qgis_resources/test_runner/qgis_testrunner.sh
@@ -13,10 +13,19 @@ TEST_NAME=$1
TEST_RUNNER_PATH=${TEST_RUNNER_PATH:-/usr/bin/qgis_testrunner.py}
QGIS_BUILD_PATH=${QGIS_BUILD_PATH:-qgis}

LOGFILE=/tmp/qgis_testrunner_$$

echo "Running test $1 ..."
OUTPUT=$(QGIS_TEST_MODULE=${TEST_NAME} unbuffer ${QGIS_BUILD_PATH} --version-migration --nologo --code ${TEST_RUNNER_PATH} "$TEST_NAME" 2>/dev/null | tee /dev/tty)
QGIS_TEST_MODULE=${TEST_NAME} unbuffer ${QGIS_BUILD_PATH} \
--version-migration --nologo --code \
${TEST_RUNNER_PATH} "$TEST_NAME" \
2>/dev/null | \
tee ${LOGFILE}

# NOTE: EXIT_CODE will always be 0 if "tee" works,
# we could `set -o pipefail` to change this
EXIT_CODE="$?"
OUTPUT=$(cat $LOGFILE) # quick hack to avoid changing too many lines
if [ -z "$OUTPUT" ]; then
echo "ERROR: no output from the test runner! (exit code: ${EXIT_CODE})"
exit 1

0 comments on commit ef0bfff

Please sign in to comment.
You can’t perform that action at this time.