diff options
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 26218b8dfe2..0000676ff26 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -29,6 +29,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::getenv($string); TeXLive::TLUtils::which($string); TeXLive::TLUtils::get_system_tmpdir(); + TeXLive::TLUtils::tl_tmpdir(); TeXLive::TLUtils::xchdir($dir); TeXLive::TLUtils::xsystem(@args); @@ -123,6 +124,7 @@ BEGIN { use Cwd; use Digest::MD5; use Getopt::Long; +use File::Temp; use TeXLive::TLConfig; $::opt_verbosity = 0; # see process_logging_options @@ -426,6 +428,16 @@ sub get_system_tmpdir { return "$systmp"; } +=item C<tl_tmpdir> + +Create a temporary directory which is cleaned up as soon as the program +is terminated. + +=cut + +sub tl_tmpdir { + return (File::Temp::tempdir(CLEANUP => 1)); +} =item C<xchdir($dir)> @@ -1415,7 +1427,7 @@ sub setup_unix_one { # try to copy it to a temp directory and make it executable # # create tmp dir only when necessary - chomp ($tmp = `mktemp -d`) unless defined($tmp); + $tmp = TeXLive::TLUtils::tl_tmpdir() unless defined($tmp); # probably we are running from DVD and want to copy it to # some temporary location copy($def, $tmp); |