aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-03-24 00:01:38 -0400
committerEli Schwartz <eschwartz93@gmail.com>2024-04-15 17:42:06 -0400
commitc99fc40bb7bacfed4ea79b4b83bec46fdc5018f3 (patch)
tree744f87a5f69628c5be11ed90e4bcb8502bcc9591 /mesonbuild
parent39f6d117926c78d3505525e6798d71a6e9bf7d74 (diff)
downloadmeson-c99fc40bb7bacfed4ea79b4b83bec46fdc5018f3.zip
meson-c99fc40bb7bacfed4ea79b4b83bec46fdc5018f3.tar.gz
meson-c99fc40bb7bacfed4ea79b4b83bec46fdc5018f3.tar.bz2
compilers: fix crash when compiler check returns None output
Popen_safe_logged has a small inefficiency. It evaluates the stripped version of stdout/stderr before checking if it exists, for logging purposes. This would sometimes crash, if it was None instead of ''. Fixes #12979
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/utils/universal.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index edb309f..324fb94 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -1587,7 +1587,7 @@ def Popen_safe_logged(args: T.List[str], msg: str = 'Called', **kwargs: T.Any) -
mlog.debug(f'{msg}: `{join_args(args)}` -> {excp}')
raise
- rc, out, err = p.returncode, o.strip(), e.strip()
+ rc, out, err = p.returncode, o.strip() if o else None, e.strip() if e else None
mlog.debug('-----------')
mlog.debug(f'{msg}: `{join_args(args)}` -> {rc}')
if out: