try {
final LocalSlaveStreamHandler streamHandler =
new LocalSlaveStreamHandler(eventBus, testsClassLoader, System.err, eventStream,
sysout, syserr, heartbeat);
final Execute execute = new Execute();
execute.setCommandline(commandline.getCommandline());
execute.setVMLauncher(true);
File cwd = getWorkingDirectory(slaveInfo);
execute.setWorkingDirectory(cwd);
execute.setStreamHandler(streamHandler);
execute.setNewenvironment(newEnvironment);
if (env.getVariables() != null)
execute.setEnvironment(env.getVariables());
log("Starting JVM J" + slaveInfo.id, Project.MSG_DEBUG);
int exitStatus = execute.execute();
log("Forked JVM J" + slaveInfo.id + " finished with exit code: "
+ exitStatus, Project.MSG_DEBUG);
if (execute.isFailure()) {
if (exitStatus == SlaveMain.ERR_NO_JUNIT) {
throw new BuildException("Forked JVM's classpath must include a junit4 JAR.");
}
if (exitStatus == SlaveMain.ERR_OLD_JUNIT) {
throw new BuildException("Forked JVM's classpath must use JUnit 4.10 or newer.");