about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-09-12 08:34:20 +0000
committerEric Wong <e@80x24.org>2019-09-14 09:24:23 +0000
commite5631087d3862823d0d4854a8dfc1258f91cb115 (patch)
treecbb6b7bf2c117fc8550f20c12116582933351131 /lib/PublicInbox/Git.pm
parentbb20bc29a831d8f84613d48af729ffaede9d43e2 (diff)
downloadpublic-inbox-e5631087d3862823d0d4854a8dfc1258f91cb115.tar.gz
Although we always unlink temporary files, give them a
meaningful name so that we can we can still make sense
of the pre-unlink name when using lsof(8) or similar
tools on Linux.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index d048051e..ff3838b3 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -12,6 +12,7 @@ use warnings;
 use POSIX qw(dup2);
 require IO::Handle;
 use PublicInbox::Spawn qw(spawn popen_rd);
+use PublicInbox::Tmpfile;
 use base qw(Exporter);
 our @EXPORT_OK = qw(git_unquote git_quote);
 
@@ -110,7 +111,8 @@ sub _bidi_pipe {
                         qw(-c core.abbrev=40 cat-file), $batch);
         my $redir = { 0 => fileno($out_r), 1 => fileno($in_w) };
         if ($err) {
-                open(my $fh, '+>', undef) or fail($self, "open.err failed: $!");
+                my $id = "git.$self->{git_dir}$batch.err";
+                my $fh = tmpfile($id) or fail($self, "tmpfile($id): $!");
                 $self->{$err} = $fh;
                 $redir->{2} = fileno($fh);
         }