From 3033f77f99d5a5cc8cbfd370861a55b15a019bb9 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 12 May 2016 08:08:19 +0200 Subject: [PATCH] travis: Use (( in travis_retry If we use [, the script exits when a condition is false (as we use set -e). --- scripts/dev/ci/travis_install.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 }