diff --git a/fs/sbin/hdfs-lib.sh b/fs/sbin/hdfs-lib.sh index 528d36f..750822e 100755 --- a/fs/sbin/hdfs-lib.sh +++ b/fs/sbin/hdfs-lib.sh @@ -30,9 +30,8 @@ function with_backoff() { local attempt=0 local exitCode=0 - while (( $attempt < $max_attempts )) - echo "Attempt $attempt of $max_attempts: $@" - do + while [ $attempt -le $max_attempts ]; do + echo "Attempt $attempt of $max_attempts: $@" set +e "$@" exitCode=$? @@ -51,6 +50,8 @@ function with_backoff() { if [[ $exitCode != 0 ]]; then echo "Fail: $@ failed to complete after $max_attempts attempts" 1>&2 + elif [[ $exitCode -gt 128 ]]; then + echo "Fail: $@ aborted by user" 1>&2 else echo "Success: $@ completed after $attempt attempts" 1>&2 fi