浏览代码

correctly handle WGET_AUTO_COMPRESSION failing when wget is missing

Nick Sweeting 5 年之前
父节点
当前提交
3f160eab8e
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 9 6
      archivebox/config.py

+ 9 - 6
archivebox/config.py

@@ -643,12 +643,15 @@ def find_chrome_data_dir() -> Optional[str]:
     return None
     return None
 
 
 def wget_supports_compression(config):
 def wget_supports_compression(config):
-    cmd = [
-        config['WGET_BINARY'],
-        "--compression=auto",
-        "--help",
-    ]
-    return not run(cmd, stdout=DEVNULL, stderr=DEVNULL).returncode
+    try:
+        cmd = [
+            config['WGET_BINARY'],
+            "--compression=auto",
+            "--help",
+        ]
+        return not run(cmd, stdout=DEVNULL, stderr=DEVNULL).returncode
+    except (FileNotFoundError, OSError):
+        return False
 
 
 def get_code_locations(config: ConfigDict) -> SimpleConfigValueDict:
 def get_code_locations(config: ConfigDict) -> SimpleConfigValueDict:
     return {
     return {