1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-10-27 20:34:20 +00:00

send SIGKILL to unterminated child jobs

If we haven't exited 2 seconds after SIGTERM, send SIGKILL. This
allows aborting of runs with wayward descendent processes.
This commit is contained in:
Oliver Giles 2020-06-20 16:05:14 +12:00
parent 1bb545e3f9
commit 559a6480ee

View File

@ -83,7 +83,10 @@ Leader::Leader(kj::AsyncIoContext &ioContext, kj::Filesystem &fs, const char *jo
scripts.pop();
// TODO: probably shouldn't do this if we are already in a runOnAbort script
kill(-currentGroupId, SIGTERM);
// TODO: wait a few seconds for exit, then send KILL?
return this->ioContext.provider->getTimer().afterDelay(2*kj::SECONDS).then([this]{
fprintf(stderr, "[laminar] sending SIGKILL to process group %d\n", currentGroupId);
kill(-currentGroupId, SIGKILL);
});
}));
pipe(setEnvPipe);