소스 검색

lock roster: catch file not found in remove() method and ignore it

Thomas Waldmann 9 년 전
부모
커밋
0a2bd8dad5
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      borg/locking.py

+ 5 - 1
borg/locking.py

@@ -176,7 +176,11 @@ class LockRoster:
             json.dump(data, f)
 
     def remove(self):
-        os.unlink(self.path)
+        try:
+            os.unlink(self.path)
+        except OSError as e:
+            if e.errno != errno.ENOENT:
+                raise
 
     def get(self, key):
         roster = self.load()