瀏覽代碼

Merge pull request #3001 from ThomasWaldmann/close-segment

with-lock: close segment file before invoking subprocess
enkore 7 年之前
父節點
當前提交
2eab60ff49
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/borg/archiver.py

+ 5 - 0
src/borg/archiver.py

@@ -1467,6 +1467,11 @@ class Archiver:
         # 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)