Skip to content

Commit ab9fe38

Browse files
xclaesserobtaylor
authored andcommitted
Rust: Use Popen_safe_logged in sanity checks
1 parent 74c8474 commit ab9fe38

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

mesonbuild/compilers/rust.py

+5-11
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import re
1919
import typing as T
2020

21-
from .. import coredata, mlog
22-
from ..mesonlib import EnvironmentException, MesonException, Popen_safe, OptionKey, join_args
21+
from .. import coredata
22+
from ..mesonlib import EnvironmentException, MesonException, Popen_safe_logged, OptionKey
2323
from .compilers import Compiler, rust_buildtype_args, clike_debug_args
2424

2525
if T.TYPE_CHECKING:
@@ -82,13 +82,7 @@ def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
8282
'''))
8383

8484
cmdlist = self.exelist + ['-o', output_name, source_name]
85-
pc, stdo, stde = Popen_safe(cmdlist, cwd=work_dir)
86-
mlog.debug('Sanity check compiler command line:', join_args(cmdlist))
87-
mlog.debug('Sanity check compile stdout:')
88-
mlog.debug(stdo)
89-
mlog.debug('-----\nSanity check compile stderr:')
90-
mlog.debug(stde)
91-
mlog.debug('-----')
85+
pc, stdo, stde = Popen_safe_logged(cmdlist, cwd=work_dir)
9286
if pc.returncode != 0:
9387
raise EnvironmentException(f'Rust compiler {self.name_string()} cannot compile programs.')
9488
if self.is_cross:
@@ -104,7 +98,7 @@ def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
10498
raise EnvironmentException(f'Executables created by Rust compiler {self.name_string()} are not runnable.')
10599
# Get libraries needed to link with a Rust staticlib
106100
cmdlist = self.exelist + ['--crate-type', 'staticlib', '--print', 'native-static-libs', source_name]
107-
p, stdo, stde = Popen_safe(cmdlist, cwd=work_dir)
101+
p, stdo, stde = Popen_safe_logged(cmdlist, cwd=work_dir)
108102
if p.returncode == 0:
109103
match = re.search('native-static-libs: (.*)$', stde, re.MULTILINE)
110104
if match:
@@ -123,7 +117,7 @@ def get_buildtype_args(self, buildtype: str) -> T.List[str]:
123117

124118
def get_sysroot(self) -> str:
125119
cmd = self.get_exelist(ccache=False) + ['--print', 'sysroot']
126-
p, stdo, stde = Popen_safe(cmd)
120+
p, stdo, stde = Popen_safe_logged(cmd)
127121
return stdo.split('\n', maxsplit=1)[0]
128122

129123
def get_debug_args(self, is_debug: bool) -> T.List[str]:

0 commit comments

Comments
 (0)