summaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2025-05-14 13:00:38 -0400
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-05-14 23:08:55 +0300
commit0ca85ebf2e6f2c7cc3bcdcae96ea00d07461bd75 (patch)
tree10aaa6f99d9b1127c5892da5009571a249dfcfa8 /unittests/allplatformstests.py
parenta096df02e17f8f0644f988c10986688d97ec1a66 (diff)
downloadmeson-0ca85ebf2e6f2c7cc3bcdcae96ea00d07461bd75.tar.gz
devenv: do not use os.execv on Windows
On Windows, os.execv spawn the process in background and returns 0. Therefore, it prevents devenv to return proper exit code from the called process. (see https://github.com/python/cpython/issues/63323 for reference.) The solution is to call subprocess.run instead, on Windows, at the price of keeping the meson python process alive while the devenv subprocess runs.
Diffstat (limited to 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 0618b20ee..b983f341c 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -4453,6 +4453,10 @@ class AllPlatformTests(BasePlatformTests):
self.assertIn(f'TEST_C="{expected}"', o)
self.assertIn('export TEST_C', o)
+ cmd = self.meson_command + ['devenv', '-C', self.builddir] + python_command + ['-c', 'import sys; sys.exit(42)']
+ result = subprocess.run(cmd, encoding='utf-8')
+ self.assertEqual(result.returncode, 42)
+
def test_clang_format_check(self):
if self.backend is not Backend.ninja:
raise SkipTest(f'Skipping clang-format tests with {self.backend.name} backend')