summaryrefslogtreecommitdiff
path: root/mysql-test/mysql-test-run.pl
diff options
context:
space:
mode:
authorMagnus Svensson <msvensson@mysql.com>2009-02-12 17:36:58 +0100
committerMagnus Svensson <msvensson@mysql.com>2009-02-12 17:36:58 +0100
commitbe5cc29e48c1fac4e031f58cb1fd31f8a8731a87 (patch)
tree58861cca220ed83981a873baacc699159bb17a95 /mysql-test/mysql-test-run.pl
parentcc5809f055ada86c58be2d76cc6dff5fcb07f338 (diff)
downloadmariadb-git-be5cc29e48c1fac4e031f58cb1fd31f8a8731a87.tar.gz
Bug#42797 mtr.pl - temporary directory are deleted when child exit's
- Since we are only using the auto cleanup in one place of mtr.pl today, disable the autocleanup and write our own END handler that clean up the tmpdir only when the process that created it exits.
Diffstat (limited to 'mysql-test/mysql-test-run.pl')
-rwxr-xr-xmysql-test/mysql-test-run.pl16
1 files changed, 15 insertions, 1 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ba426446075..f8f9b89d141 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -107,6 +107,17 @@ our $default_vardir;
our $opt_vardir; # Path to use for var/ dir
my $path_vardir_trace; # unix formatted opt_vardir for trace files
my $opt_tmpdir; # Path to use for tmp/ dir
+my $opt_tmpdir_pid;
+
+END {
+ if (defined $opt_tmpdir_pid and
+ $opt_tmpdir_pid == $$){
+ # Remove the tempdir this process has created
+ mtr_verbose("Removing tmpdir '$opt_tmpdir");
+ rmtree($opt_tmpdir);
+ }
+}
+
my $path_config_file; # The generated config file, var/my.cnf
# Visual Studio produces executables in different sub-directories based on the
@@ -1066,8 +1077,11 @@ sub command_line_setup {
" creating a shorter one...");
# Create temporary directory in standard location for temporary files
- $opt_tmpdir= tempdir( TMPDIR => 1, CLEANUP => 1 );
+ $opt_tmpdir= tempdir( TMPDIR => 1, CLEANUP => 0 );
mtr_report(" - using tmpdir: '$opt_tmpdir'\n");
+
+ # Remember pid that created dir so it's removed by correct process
+ $opt_tmpdir_pid= $$;
}
}
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any