mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +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,9 +189,14 @@ def __enter__(self):
|
|||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
if exc_type is not None:
|
||||
self.rollback()
|
||||
self.close()
|
||||
try:
|
||||
if exc_type is not None:
|
||||
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):
|
||||
"""return a borg serve command line"""
|
||||
|
|
Loading…
Reference in a new issue