summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/clangtidy.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-11-18 11:13:04 +0100
committerDylan Baker <dylan@pnwbakers.com>2024-12-19 09:25:20 -0800
commit5dc537afd051e60ff00731f73e02d98138d9198b (patch)
tree1a68b81c09dfdb71654ed363e789f14346de3b25 /mesonbuild/scripts/clangtidy.py
parentdafa6a7ac14f18e5a2529a2251fc6d552ea37547 (diff)
downloadmeson-5dc537afd051e60ff00731f73e02d98138d9198b.tar.gz
scripts: convert run_tool to asyncio
This improves the handling of keyboard interrupt, and also makes it easy to buffer the output and not mix errors from different subprocesses. This is useful for clang-tidy and will be used by clippy as well. In addition, the new code supports MESON_NUM_PROCESSES. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/scripts/clangtidy.py')
-rw-r--r--mesonbuild/scripts/clangtidy.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/scripts/clangtidy.py b/mesonbuild/scripts/clangtidy.py
index ab53bbd39..550faeef3 100644
--- a/mesonbuild/scripts/clangtidy.py
+++ b/mesonbuild/scripts/clangtidy.py
@@ -11,17 +11,17 @@ import os
import shutil
import sys
-from .run_tool import run_clang_tool
+from .run_tool import run_clang_tool, run_with_buffered_output
from ..environment import detect_clangtidy, detect_clangapply
import typing as T
-def run_clang_tidy(fname: Path, tidyexe: list, builddir: Path, fixesdir: T.Optional[Path]) -> subprocess.CompletedProcess:
+async def run_clang_tidy(fname: Path, tidyexe: list, builddir: Path, fixesdir: T.Optional[Path]) -> int:
args = []
if fixesdir is not None:
handle, name = tempfile.mkstemp(prefix=fname.name + '.', suffix='.yaml', dir=fixesdir)
os.close(handle)
args.extend(['-export-fixes', name])
- return subprocess.run(tidyexe + args + ['-quiet', '-p', str(builddir), str(fname)])
+ return await run_with_buffered_output(tidyexe + args + ['-quiet', '-p', str(builddir), str(fname)])
def run(args: T.List[str]) -> int:
parser = argparse.ArgumentParser()