aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/cmake/client.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mesonbuild/cmake/client.py b/mesonbuild/cmake/client.py
index 4581d6d..f4b549b 100644
--- a/mesonbuild/cmake/client.py
+++ b/mesonbuild/cmake/client.py
@@ -498,6 +498,15 @@ class CMakeClient:
try:
self.proc.wait(timeout=2)
except TimeoutExpired:
- self.proc.terminate()
+ # Terminate CMake if there is a timeout
+ # terminate() may throw a platform specific exception if the process has already
+ # terminated. This may be the case if there is a race condition (CMake exited after
+ # the timeout but before the terminate() call). Additionally, this behavior can
+ # also be triggered on cygwin if CMake crashes.
+ # See https://github.com/mesonbuild/meson/pull/4969#issuecomment-499413233
+ try:
+ self.proc.terminate()
+ except Exception:
+ pass
self.proc = None