Skip to content

Commit 848d4a5

Browse files
committed
calldocker helper macro
1 parent d19b206 commit 848d4a5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,23 @@ if (NBL_WITH_DOCKER)
217217
endif()
218218
endif()
219219

220+
# helper macro for stalling the script for 5 sec
220221
macro(wait5sec)
221222
execute_process(COMMAND powershell -Command "Start-Sleep -Seconds 5")
222223
endmacro()
224+
225+
# helper macro for calling docker, takes args as a string
226+
macro(calldocker args)
227+
execute_process(COMMAND ${DOCKER_EXECUTABLE} ${args} RESULT_VARIABLE DOCKER_EXIT_CODE OUTPUT_QUIET)
228+
endmacro()
223229

230+
# check if the docker daemon is running
224231
# DDT stands for Docker Daemon Test
225232
set(DDT_MAX_ATTEMPTS 10)
226233
set(DDT_DOCKER_RESPONDING False)
227234
foreach(ATTEMPT RANGE 1 ${DDT_MAX_ATTEMPTS})
228235
message(STATUS "Attempt ${ATTEMPT} of ${DDT_MAX_ATTEMPTS}: Checking Docker Endpoint")
229-
execute_process(COMMAND ${DOCKER_EXECUTABLE} info RESULT_VARIABLE DOCKER_EXIT_CODE OUTPUT_QUIET)
236+
calldocker("info")
230237

231238
if (DOCKER_EXIT_CODE EQUAL 0)
232239
set(DDT_DOCKER_RESPONDING True)
@@ -239,6 +246,7 @@ if (NBL_WITH_DOCKER)
239246
if (NOT DDT_DOCKER_RESPONDING)
240247
message(FATAL_ERROR "Docker Daemon is not responding. Please make sure it's running in the background")
241248
endif()
249+
242250
endif()
243251

244252
set(THIRD_PARTY_SOURCE_DIR "${PROJECT_SOURCE_DIR}/3rdparty")

0 commit comments

Comments
 (0)