]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/gc.py
git.packwriter: explicitly manage lifetimes
[bup.git] / lib / bup / gc.py
index b757034c827f06a3a1a89a7701c8381ca55aedcc..e8425ff0460a203614714c3073f672b44fa9ab4f 100644 (file)
@@ -209,10 +209,9 @@ def sweep(live_objects, existing_count, cat_pipe, threshold, compression,
     except BaseException as ex:
         with pending_raise(ex):
             writer.abort()
-
-    # This will finally run midx.
-    # Can only change refs (if needed) after this.
-    writer.close()
+    finally:
+        # This will finally run midx.
+        writer.close()
 
     remove_stale_files(None)  # In case we didn't write to the writer.