aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-fetch.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-29 13:06:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-29 13:06:08 +0200
commit203067a2742ad2cbb986369b216b1f1ecfb96458 (patch)
treeb3b755ca08aba82a8b780b462dce877afe9d0bea /bpkg/pkg-fetch.cxx
parentf5adc6c0ee7965abcad4cc73d0f36d1ed3cba3cc (diff)
Automatically cleanup package archive, directory on failure
Diffstat (limited to 'bpkg/pkg-fetch.cxx')
-rw-r--r--bpkg/pkg-fetch.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index 36b80a7..9da632a 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -35,6 +35,7 @@ namespace bpkg
session s;
path a;
+ auto_rm arm;
bool purge;
if (o.existing ())
@@ -96,6 +97,7 @@ namespace bpkg
<< "from " << pl->repository->name;
a = fetch_archive (o, pl->repository->location, pl->location, c);
+ arm = auto_rm (a);
purge = true;
}
@@ -138,7 +140,9 @@ namespace bpkg
});
db.persist (p);
+
t.commit ();
+ arm.cancel ();
if (verb)
text << "fetched " << p->name << " " << p->version;