win command within add_test() never returns and blocks test suite execution

I have a simple command on windows that starts an appium server on a separate windows and return:

start appium

when I try to add the corresponding test, even going through the indirection of a script, the script works on the command line but not in as COMMAND in a test. The tests launch the command but never returns.

doing my homework I found that add_test() behavior with respect to shell and variables is align with execute_process(). First naive usage of execute_process() fails wit the same symptoms:

  set( my_CMD ${CMAKE_CURRENT_SOURCEDIR}/my_script.cmd )
  execute_process( COMMAND ${my_CMD} )

Then I found #20917 . redirecting the input, error, and output pipes, it finally works the way I want it to (should be binary dir here):

  execute_process(
    COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/dev.null
    )
  set( my_CMD ${CMAKE_CURRENT_SOURCEDIR}/my_script.cmd )
  execute_process(
    COMMAND ${my_CMD}
    INPUT_FILE  ${CMAKE_CURRENT_SOURCE_DIR}/dev.null
    OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/dev.null
    ERROR_FILE  ${CMAKE_CURRENT_SOURCE_DIR}/dev.null
    RESULT_VARIABLE RESULT
    )

Unfortunately, the add_test() API does not have those options …, and in my case I cannot do this at configuration time.

I extracted the execute_process() logic into a cmake script, and then used cmake -P and it was working when invoked on the command line in a CMD shell. I tried then to use that as a tes’ COMMAND but it is again not returning:

  cmake_minimum_required(VERSION 3.18)
  project(myTest)
  include(CTEST)
  add_test(
    NAME start_appium
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/start_appium.cmake
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )

At this stage, it’s getting so convoluted that I must be missing something obvious.

What did I miss?