Skip to content

Commit

Permalink
Try harder to remove old run artefacts
Browse files Browse the repository at this point in the history
First, recursively set the permissions to 0700 so that rmtree shouldn't
fail. Then, if rmtree does fail (i.e. if the directories still exist)
die and don't proceed with the run.
  • Loading branch information
adunstan committed Apr 6, 2020
1 parent 28c386b commit 0ef76bb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions run_build.pl
Expand Up @@ -485,8 +485,20 @@ BEGIN
exit(0);
}

my $installdir = "$buildroot/$branch/inst";

# recursively fix any permissions that might stop us removing the directories
# then remove old run artefacts if any, die if not possible
my $fix_perms = sub { chmod 0700, $_; };
File::Find::find( $fix_perms, "inst");
rmtree("inst");
rmtree("$pgsql") unless ($from_source && !$use_vpath);
die "$installdir exists!" if -e "inst";
unless ($from_source && !$use_vpath)
{
File::Find::find($fix_perms, "$pgsql");
rmtree($pgsql);
die "$pgsql exists!" if -e $pgsql;
}

# we are OK to run if we get here
$have_lock = 1;
Expand Down Expand Up @@ -522,7 +534,6 @@ BEGIN
use vars qw($now);
BEGIN { $now = time; }

my $installdir = "$buildroot/$branch/inst";
my $dbstarted;

my $extraconf;
Expand Down

0 comments on commit 0ef76bb

Please sign in to comment.