From c95001b130227dde480647fec9a9f745b83db1e2 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 2 Nov 2022 20:45:25 -0400 Subject: dependencies: make the hdf5 dependency use Popen_safe It is, after all, "safe". ;) That's why it exists. There's no reason to think listing all pkg-config entries cannot print unicode descriptions, it's absolutely possible, and we should handle it properly if we encounter it. --- mesonbuild/dependencies/hdf5.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mesonbuild/dependencies/hdf5.py b/mesonbuild/dependencies/hdf5.py index c5c69e0..47ef5fe 100644 --- a/mesonbuild/dependencies/hdf5.py +++ b/mesonbuild/dependencies/hdf5.py @@ -21,7 +21,7 @@ import shutil import subprocess from pathlib import Path -from ..mesonlib import OrderedSet, join_args +from ..mesonlib import Popen_safe, OrderedSet, join_args from .base import DependencyException, DependencyMethods from .configtool import ConfigToolDependency from .pkgconfig import PkgConfigDependency @@ -163,10 +163,9 @@ def hdf5_factory(env: 'Environment', for_machine: 'MachineChoice', PCEXE = shutil.which('pkg-config') if PCEXE: # some distros put hdf5-1.2.3.pc with version number in .pc filename. - ret = subprocess.run([PCEXE, '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, - text=True) + ret, stdout, _ = Popen_safe([PCEXE, '--list-all'], stderr=subprocess.DEVNULL) if ret.returncode == 0: - for pkg in ret.stdout.split('\n'): + for pkg in stdout.split('\n'): if pkg.startswith('hdf5'): pkgconfig_files.add(pkg.split(' ', 1)[0]) -- cgit v1.1