summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm24
1 files changed, 21 insertions, 3 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index ab9b754fd31..4ed3c5a7636 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -34,6 +34,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure
TeXLive::TLUtils::which($string);
TeXLive::TLUtils::get_system_tmpdir();
TeXLive::TLUtils::tl_tmpdir();
+ TeXLive::TLUtils::tl_tmpfile();
TeXLive::TLUtils::xchdir($dir);
TeXLive::TLUtils::wsystem($msg,@args);
TeXLive::TLUtils::xsystem(@args);
@@ -479,9 +480,26 @@ is terminated.
=cut
sub tl_tmpdir {
- return (File::Temp::tempdir(CLEANUP => 1));
+ my $tmp = File::Temp::tempdir(CLEANUP => 1);
+ debug("tl_tempdir: creating tempdir $tmp\n");
+ return ($tmp);
}
+=item C<tl_tmpfile>
+
+Create a temporary file which is removed when the program
+is terminated. Returns file handle and file name.
+Arguments are passed on to C<File::Temp::tempfile>.
+
+=cut
+
+sub tl_tmpfile {
+ my ($fh, $fn) = File::Temp::tempfile(@_, UNLINK => 1);
+ debug("tl_tempfile: creating tempfile $fn\n");
+ return ($fh, $fn);
+}
+
+
=item C<xchdir($dir)>
C<chdir($dir)> or die.
@@ -2628,7 +2646,7 @@ sub check_for_old_updmap_cfg {
my $nn = "$oldupd.DISABLED";
if (-r $nn) {
my $fh;
- ($fh, $nn) = File::Temp::tempfile(
+ ($fh, $nn) = tl_tmpfile(
"updmap.cfg.DISABLED.XXXXXX", DIR => "$tmfsysconf/web2c");
}
print "Renaming old config file from
@@ -3616,7 +3634,7 @@ sub download_to_temp_or_file {
my $url = shift;
my ($url_fh, $url_file);
if ($url =~ m,^(http|ftp|file)://,) {
- ($url_fh, $url_file) = File::Temp::tempfile(UNLINK => 1);
+ ($url_fh, $url_file) = tl_tmpfile();
# now $url_fh filehandle is open, the file created
# TLUtils::download_file will just overwrite what is there
# on windows that doesn't work, so we close the fh immediately