Selaa lähdekoodia

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

Thomas Waldmann 9 vuotta sitten
vanhempi
sitoutus
0a2bd8dad5
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  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()