[scan-build-py] use subprocess wrapper to execute build
llvm-svn: 295043
diff --git a/clang/tools/scan-build-py/libscanbuild/__init__.py b/clang/tools/scan-build-py/libscanbuild/__init__.py
index f5adc86..4b5582d 100644
--- a/clang/tools/scan-build-py/libscanbuild/__init__.py
+++ b/clang/tools/scan-build-py/libscanbuild/__init__.py
@@ -39,6 +39,19 @@
return os.getenv('TMPDIR', os.getenv('TEMP', os.getenv('TMP', '/tmp')))
+def run_build(command, *args, **kwargs):
+ """ Run and report build command execution
+
+ :param command: array of tokens
+ :return: exit code of the process
+ """
+ environment = kwargs.get('env', os.environ)
+ logging.debug('run build %s, in environment: %s', command, environment)
+ exit_code = subprocess.call(command, *args, **kwargs)
+ logging.debug('build finished with exit code: %d', exit_code)
+ return exit_code
+
+
def run_command(command, cwd=None):
""" Run a given command and report the execution.