From: Eric Wong <e@80x24.org>
Date: Thu, 23 May 2019 09:36:47 +0000 (+0000)
Subject: xapcmd: do not cleanup on errors
X-Git-Tag: v1.2.0~253
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=adbf11e0f16714922b5eddb77d5227301a6d5adf;p=public-inbox.git

xapcmd: do not cleanup on errors

We move the old directory into the new directory, so avoid the
situation where a bug or error could cause the tempdir cleanup to run
and destroy both our old and new directories.
---

diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm
index 999ddd1c..81e2f101 100644
--- a/lib/PublicInbox/Xapcmd.pm
+++ b/lib/PublicInbox/Xapcmd.pm
@@ -32,7 +32,7 @@ sub run {
 	$ibx->umask_prepare;
 	my $old = $ibx->search->xdir(1);
 	-d $old or die "$old does not exist\n";
-	my $new = tempdir($cmd->[0].'-XXXXXXXX', CLEANUP => 1, DIR => $dir);
+	my $new = tempdir($cmd->[0].'-XXXXXXXX', DIR => $dir);
 	my $v = $ibx->{version} || 1;
 	my @cmds;
 	if ($v == 1) {