13
13
import subprocess
14
14
15
15
from codechecker_common .logger import get_logger
16
+ from codechecker_analyzer import analyzer_context
16
17
from codechecker_analyzer import host_check
17
18
from codechecker_analyzer .analyzers .clangsa import version
18
19
@@ -75,7 +76,7 @@ def ctu_mapping(clang_version_info):
75
76
return None , None
76
77
77
78
78
- def invoke_binary_checked (binary_path , args = None , environ = None ):
79
+ def invoke_binary_checked (binary_path , args = None ):
79
80
"""
80
81
Invoke the binary with the specified args, and return the output if the
81
82
command finished running with zero exit code. Return False otherwise.
@@ -91,6 +92,7 @@ def invoke_binary_checked(binary_path, args=None, environ=None):
91
92
args = args or []
92
93
invocation = [binary_path ]
93
94
invocation .extend (args )
95
+ environ = analyzer_context .get_context ().get_env_for_bin (binary_path )
94
96
try :
95
97
output = subprocess .check_output (
96
98
invocation ,
@@ -123,7 +125,7 @@ def __init__(self, analyzer_binary, environ):
123
125
return
124
126
125
127
analyzer_version = invoke_binary_checked (
126
- self .__analyzer_binary , ['--version' ], self . environ )
128
+ self .__analyzer_binary , ['--version' ])
127
129
128
130
if analyzer_version is False :
129
131
LOG .debug ('Failed to invoke command to get Clang version!' )
@@ -222,7 +224,7 @@ def is_ctu_capable(self):
222
224
if not tool_path :
223
225
return False
224
226
225
- return invoke_binary_checked (tool_path , ['-version' ], self . environ ) \
227
+ return invoke_binary_checked (tool_path , ['-version' ]) \
226
228
is not False
227
229
228
230
@property
@@ -233,8 +235,7 @@ def is_on_demand_ctu_available(self):
233
235
"""
234
236
235
237
analyzer_options = invoke_binary_checked (
236
- self .__analyzer_binary , ['-cc1' , '-analyzer-config-help' ],
237
- self .environ )
238
+ self .__analyzer_binary , ['-cc1' , '-analyzer-config-help' ])
238
239
239
240
if analyzer_options is False :
240
241
return False
0 commit comments