diff --git a/workspace_tools/build_api.py b/workspace_tools/build_api.py index e82ede1c42..9a7255a27f 100644 --- a/workspace_tools/build_api.py +++ b/workspace_tools/build_api.py @@ -16,11 +16,12 @@ limitations under the License. """ import tempfile +import os from os.path import join, exists, basename from shutil import rmtree from types import ListType -from workspace_tools.utils import mkdir, run_cmd +from workspace_tools.utils import mkdir, run_cmd, run_cmd_ext from workspace_tools.toolchains import TOOLCHAIN_CLASSES from workspace_tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON from workspace_tools.libraries import Library @@ -290,7 +291,7 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM tmp_file.close() check_cmd += " --file-list=%s"% tmp_file.name - _stdout, _stderr, _rc = run_cmd(check_cmd) + _stdout, _stderr, _rc = run_cmd_ext(check_cmd.split() if os.name == 'posix' else check_cmd) if verbose: print _stdout print _stderr @@ -351,7 +352,7 @@ def static_analysis_scan(target, toolchain_name, CPPCHECK_CMD, CPPCHECK_MSG_FORM tmp_file.close() check_cmd += " --file-list=%s"% tmp_file.name - _stdout, _stderr, _rc = run_cmd(check_cmd) + _stdout, _stderr, _rc = run_cmd_ext(check_cmd.split() if os.name == 'posix' else check_cmd) if verbose: print _stdout print _stderr @@ -433,7 +434,7 @@ def static_analysis_scan_library(src_paths, build_path, target, toolchain_name, tmp_file.close() check_cmd += " --file-list=%s"% tmp_file.name - _stdout, _stderr, _rc = run_cmd(check_cmd) + _stdout, _stderr, _rc = run_cmd_ext(check_cmd.split() if os.name == 'posix' else check_cmd) if verbose: print _stdout print _stderr diff --git a/workspace_tools/utils.py b/workspace_tools/utils.py index 7554dda98a..2f53d9a5d6 100644 --- a/workspace_tools/utils.py +++ b/workspace_tools/utils.py @@ -36,6 +36,13 @@ def run_cmd(command, wd=None, redirect=False): return _stdout, _stderr, p.returncode +def run_cmd_ext(command): + import subprocess + p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + _stdout, _stderr = p.communicate() + return _stdout, _stderr, p.returncode + + def mkdir(path): if not exists(path): makedirs(path)