Skip to content

Commit

Permalink
[docker] Avoid assuming /dev/tty is usable
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and nyalldawson committed May 15, 2020
1 parent b8188e2 commit 08b9bb9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .docker/qgis_resources/test_runner/qgis_testrunner.sh
Expand Up @@ -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
Expand Down

0 comments on commit 08b9bb9

Please sign in to comment.