summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.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/LastCommandAbnormalExit-1.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/LastCommandAbnormalExit-1.cmake')
-rw-r--r--Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
new file mode 100644
index 0000000..5a4574c
--- /dev/null
+++ b/Tests/RunCMake/execute_process/LastCommandAbnormalExit-1.cmake
@@ -0,0 +1,13 @@
+execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+ "import os; os.kill(os.getpid(),11)"
+ COMMAND ${CMAKE_COMMAND} -E true
+ RESULT_VARIABLE result
+ )
+
+if(result EQUAL "0")
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+ "import os; os.kill(os.getpid(),11)"
+ COMMAND ${CMAKE_COMMAND} -E true
+ COMMAND_ERROR_IS_FATAL LAST
+ )
+endif()