execute_process: RESULTS_VARIABLE does not work with TIMEOUT
Given cmake script
execute_process(
COMMAND ${CMAKE_COMMAND} -E sleep 10
COMMAND ${CMAKE_COMMAND} -E sleep 20
RESULT_VARIABLE last
RESULTS_VARIABLE all
TIMEOUT 15
)
message(STATUS "RESULT_VARIABLE: [${last}]")
message(STATUS "RESULTS_VARIABLE: [${all}]")
The output is
$ cmake -P cmd.cmake
-- RESULT_VARIABLE: [Process terminated due to timeout]
-- RESULTS_VARIABLE: [Process terminated due to timeout]
But according to the doc of RESULTS_VARIABLE
:
Each entry will be an integer return code from the corresponding child or a string describing an error condition.
I would except the output be:
-- RESULT_VARIABLE: [Process terminated due to timeout]
-- RESULTS_VARIABLE: [0;Process terminated due to timeout]