summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/execute_process/LastCommandGood.cmake
diff options
context:
space:
mode:
authorAsit Dhal <dhal.asitk@gmail.com>2020-12-08 08:51:00 (GMT)
committerBrad King <brad.king@kitware.com>2020-12-10 11:09:59 (GMT)
commite5a4ffaad166de7a8b907919ca2d805a3ec72c39 (patch)
treedc88ffe172348ecb4a33cd3a206ba18964942c4e /Tests/RunCMake/execute_process/LastCommandGood.cmake
parent8a3ecb484fb04aa9fb8b9f6d198b3a6942c26115 (diff)
downloadCMake-e5a4ffaad166de7a8b907919ca2d805a3ec72c39.zip
CMake-e5a4ffaad166de7a8b907919ca2d805a3ec72c39.tar.gz
CMake-e5a4ffaad166de7a8b907919ca2d805a3ec72c39.tar.bz2
execute_process: Improve COMMAND_ERROR_IS_FATAL error capture scenarios
1. COMMAND_ERROR_IS_FATAL ANY will capture errors if the exit code is non zero, there is a timeout or an abnormal exit. 2. COMMAND_ERROR_IS_FATAL LAST will capture if only the last process has an exit code non zero, there is a timeout or an abnormal exit. Fixes: #21562
Diffstat (limited to 'Tests/RunCMake/execute_process/LastCommandGood.cmake')
-rw-r--r--Tests/RunCMake/execute_process/LastCommandGood.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/execute_process/LastCommandGood.cmake b/Tests/RunCMake/execute_process/LastCommandGood.cmake
new file mode 100644
index 0000000..c22b49d
--- /dev/null
+++ b/Tests/RunCMake/execute_process/LastCommandGood.cmake
@@ -0,0 +1,15 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E true
+ RESULT_VARIABLE result
+ )
+
+if(result EQUAL "0")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E false
+ COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND_ERROR_IS_FATAL LAST
+ )
+endif()