about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-26 09:03:15 +0000
committerEric Wong <e@yhbt.net>2020-07-26 23:46:37 +0000
commit999e8c1b3d54f4504cd4fa87949a077da325a1af (patch)
treeeec5c3b9db9a742c182769a74bb70e3f30368049 /script
parentc3ba74805e58b006768f3a29c3688a0a1d0bacaf (diff)
downloadpublic-inbox-999e8c1b3d54f4504cd4fa87949a077da325a1af.tar.gz
Tests for failures should not leave junk temporary files lying
around in a users' ~/.public-inbox/.

On a side note, I'm not sure if PI_DIR is or was ever
necessary.  It's never been documented, so perhaps
using $HOME for this is better...
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-init2
1 files changed, 2 insertions, 0 deletions
diff --git a/script/public-inbox-init b/script/public-inbox-init
index 951338af..b8d71f35 100755
--- a/script/public-inbox-init
+++ b/script/public-inbox-init
@@ -53,6 +53,7 @@ PublicInbox::Lock::lock_acquire($lock_obj);
 
 # git-config will operate on this (and rename on success):
 my ($fh, $pi_config_tmp) = tempfile('pi-init-XXXXXXXX', DIR => $dir);
+my $cfg_tmp = UnlinkMe->new($pi_config_tmp);
 
 # Now, we grab another lock to use git-config(1) locking, so it won't
 # wait on the lock, unlike some of our internal flock()-based locks.
@@ -176,6 +177,7 @@ if (defined $perm) {
 
 rename $pi_config_tmp, $pi_config or
         die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n";
+delete $cfg_tmp->{file};
 $auto_unlink->DESTROY;
 
 package UnlinkMe;