From 16d953b937da7e0e3ed91dcb2060cb749491add4 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Mon, 24 Apr 2017 11:53:28 +0200 Subject: [PATCH] BUG: allow 3 retry for remote module cloning --- CMake/OTBModuleRemote.cmake | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CMake/OTBModuleRemote.cmake b/CMake/OTBModuleRemote.cmake index 74f6b170ee..c0c7aa4af2 100644 --- a/CMake/OTBModuleRemote.cmake +++ b/CMake/OTBModuleRemote.cmake @@ -22,12 +22,17 @@ # Helper to perform the initial git clone and checkout. function(_git_clone git_executable git_repository git_tag module_dir) - execute_process( - COMMAND "${git_executable}" clone "${git_repository}" "${module_dir}" - RESULT_VARIABLE error_code - OUTPUT_QUIET - ERROR_QUIET - ) + set(retryCount 0) + set(error_code 1) + while(error_code AND (retryCount LESS 3)) + execute_process( + COMMAND "${git_executable}" clone "${git_repository}" "${module_dir}" + RESULT_VARIABLE error_code + OUTPUT_QUIET + ERROR_QUIET + ) + math(EXPR retryCount "${retryCount}+1") + endwhile() if(error_code) message(FATAL_ERROR "Failed to clone repository: '${git_repository}'") endif() -- GitLab