Merge pull request #4226 from driquelme/fix_ctrl_c_forked_test

Fix CTRL-C exception
This commit is contained in:
eugene yokota 2018-06-25 22:23:43 -04:00 committed by GitHub
commit 0c3a458e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();