diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-04-23 00:27:25 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-05-16 11:19:43 -0400 |
commit | 057ac1f5760933292cf80da63cd3ad19bcabab64 (patch) | |
tree | c5b3912cc7b2379369c93099b04aef4a019fb02c | |
parent | 0b5e95ae71492663e2207db816bf38e8f56d9c7e (diff) | |
download | meson-057ac1f5760933292cf80da63cd3ad19bcabab64.tar.gz |
rust compiler: use better sanity check logging comparable to the clike one
Don't spew debug-level info. Log the actual command line run.
-rw-r--r-- | mesonbuild/compilers/rust.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 3f353e24e..a63e6643e 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -17,8 +17,8 @@ import subprocess, os.path import textwrap import typing as T -from .. import coredata -from ..mesonlib import EnvironmentException, MesonException, Popen_safe, OptionKey +from .. import coredata, mlog +from ..mesonlib import EnvironmentException, MesonException, Popen_safe, OptionKey, join_args from .compilers import Compiler, rust_buildtype_args, clike_debug_args if T.TYPE_CHECKING: @@ -78,7 +78,9 @@ class RustCompiler(Compiler): '''fn main() { } ''')) - pc = subprocess.Popen(self.exelist + ['-o', output_name, source_name], + + cmdlist = self.exelist + ['-o', output_name, source_name] + pc = subprocess.Popen(cmdlist, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=work_dir) @@ -87,11 +89,15 @@ class RustCompiler(Compiler): assert isinstance(_stde, bytes) stdo = _stdo.decode('utf-8', errors='replace') stde = _stde.decode('utf-8', errors='replace') + + mlog.debug('Sanity check compiler command line:', join_args(cmdlist)) + mlog.debug('Sanity check compile stdout:') + mlog.debug(stdo) + mlog.debug('-----\nSanity check compile stderr:') + mlog.debug(stde) + mlog.debug('-----') if pc.returncode != 0: - raise EnvironmentException('Rust compiler {} cannot compile programs.\n{}\n{}'.format( - self.name_string(), - stdo, - stde)) + raise EnvironmentException(f'Rust compiler {self.name_string()} cannot compile programs.') if self.is_cross: if self.exe_wrapper is None: # Can't check if the binaries run so we have to assume they do |