Kill children processes when interrupting the build, fixes #343

This commit is contained in:
Guillaume Nodet
2021-02-15 13:03:14 +01:00
parent 34779fd7a0
commit 5fa1f3bd2f

View File

@@ -389,6 +389,11 @@ public class Server implements AutoCloseable, Runnable {
final SmartBuilder builder = SmartBuilder.cancel();
stateLock.lock();
try {
try {
ProcessHandle.current().descendants().forEach(ProcessHandle::destroy);
} catch (Throwable t) {
t.printStackTrace();
}
long rem;
while ((rem = time - System.currentTimeMillis()) > 0) {
try {