diff --git a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py index 22e588b9ad..0ccac12eb8 100644 --- a/analyzer/codechecker_analyzer/analyzers/analyzer_types.py +++ b/analyzer/codechecker_analyzer/analyzers/analyzer_types.py @@ -159,7 +159,6 @@ def check_supported_analyzers(analyzers): """ context = analyzer_context.get_context() - check_env = context.cc_env analyzer_binaries = context.analyzer_binaries @@ -182,7 +181,8 @@ def check_supported_analyzers(analyzers): elif not os.path.isabs(analyzer_bin): # If the analyzer is not in an absolute path, try to find it... found_bin = supported_analyzers[analyzer_name].\ - resolve_missing_binary(analyzer_bin, check_env) + resolve_missing_binary(analyzer_bin, + context.get_analyzer_env(analyzer_name)) # found_bin is an absolute path, an executable in one of the # PATH folders. @@ -201,7 +201,8 @@ def check_supported_analyzers(analyzers): # Check version compatibility of the analyzer binary. if analyzer_bin: analyzer = supported_analyzers[analyzer_name] - error = analyzer.is_binary_version_incompatible(check_env) + error = analyzer.is_binary_version_incompatible( + context.get_analyzer_env(analyzer_name)) if error: failed_analyzers.add((analyzer_name, f"Incompatible version: {error} " @@ -211,7 +212,9 @@ def check_supported_analyzers(analyzers): available_analyzer = False if not analyzer_bin or \ - not host_check.check_analyzer(analyzer_bin, check_env): + not host_check.check_analyzer(analyzer_bin, + context. + get_analyzer_env(analyzer_name)): # Analyzers unavailable under absolute paths are deliberately a # configuration problem. failed_analyzers.add((analyzer_name, diff --git a/analyzer/codechecker_analyzer/host_check.py b/analyzer/codechecker_analyzer/host_check.py index 494818d742..dc6c0c5cc1 100644 --- a/analyzer/codechecker_analyzer/host_check.py +++ b/analyzer/codechecker_analyzer/host_check.py @@ -28,17 +28,22 @@ def check_analyzer(compiler_bin, env): clang_version_cmd = [compiler_bin, '--version'] LOG.debug_analyzer(' '.join(clang_version_cmd)) try: - res = subprocess.call( + proc = subprocess.Popen( clang_version_cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", errors="ignore") - if not res: + out, err = proc.communicate() + LOG.debug_analyzer("return code %d", proc.returncode) + if not proc.returncode: return True - + LOG.debug_analyzer("ENV:") + LOG.debug_analyzer(env) LOG.debug_analyzer('Failed to run: "%s"', ' '.join(clang_version_cmd)) + LOG.debug_analyzer('stdout: %s', out) + LOG.debug_analyzer('stderr: %s', err) return False except OSError as oerr: