about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-12-25 08:52:41 +0000
committerEric Wong <e@80x24.org>2016-12-26 10:03:14 +0000
commitfa849271ab532f3c09bf20255a4cf17c268a3e7a (patch)
tree5e110fb6a567aa9cadbd9f684ea9a9cb83add09b /lib/PublicInbox/Git.pm
parente36899b149ecb7cc56f88a6078b18b211ac3c793 (diff)
downloadpublic-inbox-fa849271ab532f3c09bf20255a4cf17c268a3e7a.tar.gz
We may not keep this feature after all, but for now we'll hold
off on creating it to cheapen instantiation.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index dee027a3..4dfc4099 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -12,7 +12,6 @@ use warnings;
 use POSIX qw(dup2);
 require IO::Handle;
 use PublicInbox::Spawn qw(spawn popen_rd);
-use IO::File;
 use Fcntl qw(:seek);
 
 # Documentation/SubmittingPatches recommends 12 (Linux v4.4)
@@ -22,11 +21,15 @@ sub abbrev { "--abbrev=$abbrev" }
 
 sub new {
         my ($class, $git_dir) = @_;
-        bless { git_dir => $git_dir, err => IO::File->new_tmpfile }, $class
+        bless { git_dir => $git_dir }, $class
 }
 
 sub err_begin ($) {
         my $err = $_[0]->{err};
+        unless ($err) {
+                open($err, '+>', undef);
+                $_[0]->{err} = $err;
+        }
         sysseek($err, 0, SEEK_SET) or die "sysseek failed: $!";
         truncate($err, 0) or die "truncate failed: $!";
         my $ret = fileno($err);
@@ -35,7 +38,7 @@ sub err_begin ($) {
 }
 
 sub err ($) {
-        my $err = $_[0]->{err};
+        my $err = $_[0]->{err} or return '';
         sysseek($err, 0, SEEK_SET) or die "sysseek failed: $!";
         defined(sysread($err, my $buf, -s $err)) or die "sysread failed: $!";
         sysseek($err, 0, SEEK_SET) or die "sysseek failed: $!";