failure to remove rundir should not abort the jobrunner

kj::Directory::remove will throw if it fails to remove some files, e.g. in
case of insufficient permissions. Catch this and move right along.

resolves #156
pull/158/head
Oliver Giles 3 years ago
parent 02810309fc
commit d01cf1c9b0

@ -774,7 +774,14 @@ void Laminar::handleRunFinished(Run * r) {
// anyway so hence this (admittedly debatable) optimization.
if(!fsHome->exists(d))
break;
fsHome->remove(d);
// must use a try/catch because remove will throw if deletion fails. Using
// tryRemove does not help because it still throws an exception for some
// errors such as EACCES
try {
fsHome->remove(d);
} catch(kj::Exception& e) {
LLOG(ERROR, "Could not remove directory", e.getDescription());
}
}
fsHome->symlink(kj::Path{"archive", r->name, "latest"}, std::to_string(r->build), kj::WriteMode::CREATE|kj::WriteMode::MODIFY);

Loading…
Cancel
Save