浏览代码

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.
Ross Williams 2 年之前
父节点
当前提交
9d9872d325
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      archivebox/config.py

+ 2 - 1
archivebox/config.py

@@ -690,7 +690,8 @@ def bin_version(binary: Optional[str]) -> Optional[str]:
         return None
         return None
 
 
     try:
     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:
         if not version_str:
             version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode()
             version_str = run([abspath, "--version"], stdout=PIPE).stdout.strip().decode()
         # take first 3 columns of first line of version info
         # take first 3 columns of first line of version info