diff --git a/scripts/dev/ci/travis_install.sh b/scripts/dev/ci/travis_install.sh index 32b44bca1..f6a6feb7e 100644 --- a/scripts/dev/ci/travis_install.sh +++ b/scripts/dev/ci/travis_install.sh @@ -18,25 +18,26 @@ # along with qutebrowser. If not, see . # Stolen from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh +# and adjusted to use ((...)) travis_retry() { local ANSI_RED="\033[31;1m" local ANSI_RESET="\033[0m" local result=0 local count=1 - while [ $count -le 3 ]; do - [ $result -ne 0 ] && { + while (( count < 3 )); do + if (( result != 0 )); then echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" >&2 - } + fi "$@" result=$? - [ $result -eq 0 ] && break + (( result == 0 )) && break count=$(($count + 1)) sleep 1 done - [ $count -gt 3 ] && { + if (( count > 3 )); then echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" >&2 - } + fi return $result }