瀏覽代碼

locking (win32): deal with os.listdir PermissionErrors

due to unclear circumstances, windows sometimes just says "PermissionError" when trying to list a directory.
Thomas Waldmann 2 年之前
父節點
當前提交
7063c2abec
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/borg/locking.py

+ 2 - 0
src/borg/locking.py

@@ -191,6 +191,8 @@ class ExclusiveLock:
             names = os.listdir(self.path)
             names = os.listdir(self.path)
         except FileNotFoundError:  # another process did our job in the meantime.
         except FileNotFoundError:  # another process did our job in the meantime.
             pass
             pass
+        except PermissionError:  # win32 might throw this.
+            return False
         else:
         else:
             for name in names:
             for name in names:
                 try:
                 try: