Collect and return clang-format's return code

There is no reason why meson should swallow any non-zero exit(/return)
code of clang-format.
pull/5682/merge
Florian Schmaus 4 years ago committed by Jussi Pakkanen
parent 8bc656cccb
commit eb2c26b2c2
  1. 7
      mesonbuild/scripts/clangformat.py

@ -25,6 +25,7 @@ def clangformat(exelist: T.List[str], srcdir_name: str, builddir_name: str) -> i
suffixes = set(lang_suffixes['c']).union(set(lang_suffixes['cpp'])) suffixes = set(lang_suffixes['c']).union(set(lang_suffixes['cpp']))
suffixes.add('h') suffixes.add('h')
futures = [] futures = []
returncode = 0
with ThreadPoolExecutor() as e: with ThreadPoolExecutor() as e:
for f in (x for suff in suffixes for x in srcdir.glob('**/*.' + suff)): for f in (x for suff in suffixes for x in srcdir.glob('**/*.' + suff)):
if f.is_dir(): if f.is_dir():
@ -32,9 +33,9 @@ def clangformat(exelist: T.List[str], srcdir_name: str, builddir_name: str) -> i
strf = str(f) strf = str(f)
if strf.startswith(builddir_name): if strf.startswith(builddir_name):
continue continue
futures.append(e.submit(subprocess.check_call, exelist + ['-style=file', '-i', strf])) futures.append(e.submit(subprocess.run, exelist + ['-style=file', '-i', strf]))
[x.result() for x in futures] returncode = max([x.result().returncode for x in futures])
return 0 return returncode
def run(args: T.List[str]) -> int: def run(args: T.List[str]) -> int:
srcdir_name = args[0] srcdir_name = args[0]

Loading…
Cancel
Save