diff options
Diffstat (limited to 'bpkg/pkg-unpack.cxx')
-rw-r--r-- | bpkg/pkg-unpack.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx index ba98b0b..84dd5ae 100644 --- a/bpkg/pkg-unpack.cxx +++ b/bpkg/pkg-unpack.cxx @@ -115,6 +115,11 @@ namespace bpkg if (exists (d)) fail << "package directory " << d << " already exists"; + // What should we do if tar or something after it fails? Cleaning + // up the package directory sounds like the right thing to do. + // + auto_rm_r arm (d); + const char* args[] { "tar", "-C", c.string ().c_str (), // -C/--directory -- change to directory. @@ -125,17 +130,6 @@ namespace bpkg if (verb >= 2) print_process (args); - // What should we do if tar or something after it fails? Cleaning - // up the package directory sounds like the right thing to do. - // - auto dg ( - make_exception_guard ( - [&d]() - { - if (exists (d)) - rm_r (d); - })); - try { process pr (args); @@ -165,6 +159,8 @@ namespace bpkg db.update (p); t.commit (); + arm.cancel (); + return p; } |