Fix bin_version: set LANG=C when calling executables to avoid parsing

localized output.
This commit is contained in:
Pellaeon Lin 2022-02-24 17:01:00 +08:00
parent bf432d4931
commit 5e9d05483e

View file

@ -650,7 +650,7 @@ def bin_version(binary: Optional[str]) -> Optional[str]:
return None
try:
version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode()
version_str = run([abspath, "--version"], stdout=PIPE, env={'LANG': 'C'}).stdout.strip().decode()
# take first 3 columns of first line of version info
return ' '.join(version_str.split('\n')[0].strip().split()[:3])
except OSError: