From 2fd905581081f8584a4993ad655eddb98a2485c2 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 10 Jul 2023 10:51:52 -0400 Subject: [PATCH] mtest: redirect automatic reconfiguring to stderr when listing tests It is not the primary purpose of mtest, and it ends up mingled with a list of actual tests, which isn't nice if you're trying to capture and parse this. --- mesonbuild/mtest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index ed3495aea..313e79b80 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1608,7 +1608,8 @@ class TestHarness: if not self.options.no_rebuild: teststdo = subprocess.run(self.ninja + ['-n', 'build.ninja'], capture_output=True).stdout if b'ninja: no work to do.' not in teststdo and b'samu: nothing to do' not in teststdo: - ret = subprocess.run(self.ninja + ['build.ninja']) + stdo = sys.stderr if self.options.list else sys.stdout + ret = subprocess.run(self.ninja + ['build.ninja'], stdout=stdo.fileno()) if ret.returncode != 0: raise TestException(f'Could not configure {self.options.wd!r}')