Set up logging before trying to lock the sandbox; otherwise tbmaster(1)

will just log a mysterious "tinderbox returned exit code 35".
This commit is contained in:
Dag-Erling Smørgrav 2004-06-22 08:34:46 +00:00
parent 889608790b
commit ed18bbe9cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130915

View File

@ -378,21 +378,6 @@ MAIN:{
$cmds{$cmd} = 1;
}
# Take control of our sandbox
if ($sandbox !~ m|^(/[\w./-]+)$|) {
error("invalid sandbox directory");
}
$sandbox = "$1/$branch/$arch/$machine";
$ENV{'HOME'} = $sandbox;
make_dir($sandbox)
or error("$sandbox: $!");
my $lockfile = open_locked("$sandbox/lock", O_RDWR|O_CREAT);
if (!defined($lockfile)) {
error("unable to lock sandbox");
}
truncate($lockfile, 0);
print($lockfile "$$\n");
# Open logfile
open(STDIN, '<', "/dev/null")
or error("/dev/null: $!\n");
@ -412,6 +397,21 @@ MAIN:{
$SIG{__DIE__} = \&sigdie;
$SIG{__WARN__} = \&sigwarn;
# Take control of our sandbox
if ($sandbox !~ m|^(/[\w./-]+)$|) {
error("invalid sandbox directory");
}
$sandbox = "$1/$branch/$arch/$machine";
$ENV{'HOME'} = $sandbox;
make_dir($sandbox)
or error("$sandbox: $!");
my $lockfile = open_locked("$sandbox/lock", O_RDWR|O_CREAT);
if (!defined($lockfile)) {
error("unable to lock sandbox");
}
truncate($lockfile, 0);
print($lockfile "$$\n");
# Clean up remains from old runs
if ($cmds{'clean'}) {
logstage("cleaning the sandbox");