1
0
Fork 0
mirror of synced 2024-06-18 18:34:51 +12:00

bin_version means to modify, not replace environ

the `bin_version` function means to modify the environment,
not replace it entirely. Fixes bugs that occur when it wipes out the
PATH environment variable, such as when running in a virtual
environment.
This commit is contained in:
Ross Williams 2023-03-20 14:25:29 -04:00
parent 3e5e9c7a41
commit 9d9872d325

View file

@ -690,7 +690,8 @@ def bin_version(binary: Optional[str]) -> Optional[str]:
return None
try:
version_str = run([abspath, "--version"], stdout=PIPE, env={'LANG': 'C'}).stdout.strip().decode()
bin_env = os.environ | {'LANG': 'C'}
version_str = run([abspath, "--version"], stdout=PIPE, env=bin_env).stdout.strip().decode()
if not version_str:
version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode()
# take first 3 columns of first line of version info