From 84b7969b72af218f948078eb8ee46a97783f24de Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 11 Feb 2013 18:01:27 +0100 Subject: [PATCH] Return the exit code from tox to callers of run_tests.sh Invoking PIPESTATUS appears to be volatile in my environment, after the if condition it is already again 0, even if it was non-zero before. Capture the result permanently in a variable and use that one consistently. Also handle the just-pep8 case correctly. Change-Id: Icca8c00c8d2189da1a133db277c9071c2d6c880b --- run_tests.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 6bee8057..d2e18e86 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -35,13 +35,13 @@ for arg in "$@"; do done if [ $just_pep8 -eq 1 ]; then - tox -e pep8 - exit + exec tox -e pep8 fi -tox -e py27 $toxargs 2>&1 | tee run_tests.err.log || exit -if [ ${PIPESTATUS[0]} -ne 0 ]; then - exit ${PIPESTATUS[0]} +tox -e py27 $toxargs 2>&1 | tee run_tests.err.log || exit 1 +tox_exit_code=${PIPESTATUS[0]} +if [ 0$tox_exit_code -ne 0 ]; then + exit $tox_exit_code fi if [ -z "$toxargs" ]; then