aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-05-16 11:08:02 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-05-20 10:35:42 -0400
commit01bb7564847dded2c9de756363c2ff97f0a02a8e (patch)
tree99465d54b65602785ce8c063e8b9d8695a1407b9 /mesonbuild
parent6f4973abad9eec9fcc915117f1c3d1a93ccc948c (diff)
downloadmeson-01bb7564847dded2c9de756363c2ff97f0a02a8e.zip
meson-01bb7564847dded2c9de756363c2ff97f0a02a8e.tar.gz
meson-01bb7564847dded2c9de756363c2ff97f0a02a8e.tar.bz2
rust: Use Popen_safe() for sanity checks
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/rust.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index a63e664..abdc2b3 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -80,16 +80,7 @@ class RustCompiler(Compiler):
'''))
cmdlist = self.exelist + ['-o', output_name, source_name]
- pc = subprocess.Popen(cmdlist,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- cwd=work_dir)
- _stdo, _stde = pc.communicate()
- assert isinstance(_stdo, bytes)
- assert isinstance(_stde, bytes)
- stdo = _stdo.decode('utf-8', errors='replace')
- stde = _stde.decode('utf-8', errors='replace')
-
+ pc, stdo, stde = Popen_safe(cmdlist, cwd=work_dir)
mlog.debug('Sanity check compiler command line:', join_args(cmdlist))
mlog.debug('Sanity check compile stdout:')
mlog.debug(stdo)
@@ -108,7 +99,7 @@ class RustCompiler(Compiler):
pe = subprocess.Popen(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
pe.wait()
if pe.returncode != 0:
- raise EnvironmentException('Executables created by Rust compiler %s are not runnable.' % self.name_string())
+ raise EnvironmentException(f'Executables created by Rust compiler {self.name_string()} are not runnable.')
def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
return ['--dep-info', outfile]