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:
parent
9ae1351bec
commit
9725c03299
1 changed files with 8 additions and 3 deletions
|
@ -189,8 +189,13 @@ 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):
|
||||||
|
try:
|
||||||
if exc_type is not None:
|
if exc_type is not None:
|
||||||
self.rollback()
|
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()
|
self.close()
|
||||||
|
|
||||||
def borg_cmd(self, args, testing):
|
def borg_cmd(self, args, testing):
|
||||||
|
|
Loading…
Reference in a new issue