1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-03 21:56:44 +00:00

Merge pull request #3006 from ThomasWaldmann/close-segment-1.1

with-lock: close segment file before invoking subprocess (1.1-maint)
This commit is contained in:
TW 2017-09-07 15:15:47 +02:00 committed by GitHub
commit 37cb3b496e

View file

@ -1664,6 +1664,11 @@ def do_with_lock(self, args, repository):
# the encryption key (and can operate just with encrypted data).
data = repository.get(Manifest.MANIFEST_ID)
repository.put(Manifest.MANIFEST_ID, data)
# usually, a 0 byte (open for writing) segment file would be visible in the filesystem here.
# we write and close this file, to rather have a valid segment file on disk, before invoking the subprocess.
# we can only do this for local repositories (with .io), though:
if hasattr(repository, 'io'):
repository.io.close_segment()
try:
# we exit with the return code we get from the subprocess
return subprocess.call([args.command] + args.args)