CMake 3.19 added a new COMMAND_ERROR_IS_FATAL
option to the execute_process()
command. The goal as originally stated in the issue was to be able to replace code like this:
execute_process(COMMAND foo RESULT_VARIABLE _result)
if(_result)
message(FATAL_ERROR "foo returned ${_result}, should be 0")
endif()
With something more concise, which ended up being this:
execute_process(COMMAND foo COMMAND_ERROR_IS_FATAL ANY)
This change was made in MR 5243. In those discussions, we didn’t consider the effect of the TIMEOUT
option. If the TIMEOUT
option is used, we still have to provide a result variable and check it using the old method because it isn’t handled by COMMAND_ERROR_IS_FATAL
. Should we consider this a bug in the implementation and fix it in 3.19.2, or is a timeout something we want to keep separate that COMMAND_ERROR_IS_FATAL
should not catch?
Cc: @kyle.edwards