Explorar o código

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

Thomas Waldmann %!s(int64=9) %!d(string=hai) anos
pai
achega
0a2bd8dad5
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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()