Fix CTRL-C exception

This commit is contained in:
Daniel Riquelme 2018-06-22 05:04:30 -04:00
parent a34f76bab7
commit aee10cf036
1 changed files with 10 additions and 0 deletions

View File

@ -258,9 +258,19 @@ final public class ForkMain {
final Task[] tasks = runner.tasks(filteredTests.toArray(new TaskDef[filteredTests.size()]));
logDebug(os, "Runner for " + framework.getClass().getName() + " produced " + tasks.length + " initial tasks for " + filteredTests.size() + " tests.");
Thread callDoneOnShutdown = new Thread() {
@Override
public void run() {
runner.done();
}
};
Runtime.getRuntime().addShutdownHook(callDoneOnShutdown);
runTestTasks(executor, tasks, loggers, os);
runner.done();
Runtime.getRuntime().removeShutdownHook(callDoneOnShutdown);
}
write(os, ForkTags.Done);
is.readObject();