From 9a9ea1434ab4d204d73503a61d5c1a044ce07366 Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Thu, 6 Jun 2019 11:07:12 +0200 Subject: [PATCH] cmake: Fix cygwin failures --- mesonbuild/cmake/client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mesonbuild/cmake/client.py b/mesonbuild/cmake/client.py index 4581d6d5d..f4b549b14 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