From: Kornel Benko Date: Sat, 2 Jul 2011 20:43:10 +0000 (+0000) Subject: Use true temporary files X-Git-Tag: 2.1.0beta1~2971 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e8910e73f042a08998c78c42593b41b7e25bde8f;p=lyx.git Use true temporary files git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39235 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/po/diff_po.pl b/po/diff_po.pl index a39fbb7085..86fedc8151 100755 --- a/po/diff_po.pl +++ b/po/diff_po.pl @@ -33,6 +33,7 @@ use strict; use Term::ANSIColor qw(:constants); +use File::Temp; my ($status, $foundline, $msgid, $msgstr, $fuzzy); @@ -43,7 +44,6 @@ my %Fuzzy = (); # inside new po-file my $result = 0; # exit value my $printlines = 0; my @names = (); -my $tmpfile = "/tmp/blax"; # Check first, if called as standalone program for git if ($ARGV[0] =~ /^-r(.*)/) { @@ -65,16 +65,16 @@ if ($ARGV[0] =~ /^-r(.*)/) { } if (-d "$filedir/../.git") { my @args = (); + my $tmpfile = File::Temp->new(); push(@args, "-L", $argf . " (" . $rev . ")"); push(@args, "-L", $argf . " (local copy)"); open(FI, "git show $rev:po/$baseargf|"); - open(FO, '>', $tmpfile); + $tmpfile->unlink_on_destroy( 1 ); while(my $l = ) { - print FO $l; + print $tmpfile $l; } close(FI); - close(FO); - push(@args, $tmpfile, $argf); + push(@args, $tmpfile->filename, $argf); print "===================================================================\n"; &diff_po(@args); }