about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rwxr-xr-xscript/public-inbox-edit12
1 files changed, 9 insertions, 3 deletions
diff --git a/script/public-inbox-edit b/script/public-inbox-edit
index c9884053..0accd7c1 100755
--- a/script/public-inbox-edit
+++ b/script/public-inbox-edit
@@ -8,7 +8,7 @@ use strict;
 use warnings;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 use PublicInbox::AdminEdit;
-use File::Temp qw(tempfile);
+use File::Temp ();
 use PublicInbox::ContentId qw(content_id);
 use PublicInbox::MID qw(mid_clean mids);
 PublicInbox::Admin::check_require('-index');
@@ -120,10 +120,16 @@ $mids
         $found = { $cid => $to_edit };
 }
 
-my $tmpl = 'public-inbox-edit-XXXXXX';
+my %tmpopt = (
+        TEMPLATE => 'public-inbox-edit-XXXXXX',
+        TMPDIR => 1,
+        SUFFIX => $opt->{raw} ? '.eml' : '.mbox',
+);
+
 foreach my $to_edit (values %$found) {
-        my ($edit_fh, $edit_fn) = tempfile($tmpl, TMPDIR => 1, UNLINK => 1);
+        my $edit_fh = File::Temp->new(%tmpopt);
         $edit_fh->autoflush(1);
+        my $edit_fn = $edit_fh->filename;
         my ($ibx, $smsg) = @{$to_edit->[0]};
         my $old_raw = $ibx->msg_by_smsg($smsg);
         delete @$ibx{qw(over mm git search)}; # cleanup