1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

close the repo on exit - even if rollback did not work, fixes #1197

This commit is contained in:
Thomas Waldmann 2016-07-03 02:58:17 +02:00
parent 9ae1351bec
commit 9725c03299

View file

@ -189,9 +189,14 @@ def __enter__(self):
return self return self
def __exit__(self, exc_type, exc_val, exc_tb): def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is not None: try:
self.rollback() if exc_type is not None:
self.close() self.rollback()
finally:
# in any case, we want to cleanly close the repo, even if the
# rollback can not succeed (e.g. because the connection was
# already closed) and raised another exception:
self.close()
def borg_cmd(self, args, testing): def borg_cmd(self, args, testing):
"""return a borg serve command line""" """return a borg serve command line"""