if (systemProperties != null) {
cli.createArg().setFile(systemProperties);
}
ForkingStreamConsumer out = getForkingStreamConsumer(showHeading, showFooter, redirectTestOutputToFile);
StreamConsumer err;
if (redirectTestOutputToFile) {
err = out;
} else {
err = getForkingStreamConsumer(showHeading, showFooter, redirectTestOutputToFile);
}
if (forkConfiguration.isDebug()) {
System.out.println("Forking command line: " + cli);
}
int returnCode;
try {
returnCode =
org.apache.maven.surefire.booter.shade.org.codehaus.plexus.util.cli.CommandLineUtils
.executeCommandLine(cli, out, err, forkedProcessTimeoutInSeconds);
} catch (org.apache.maven.surefire.booter.shade.org.codehaus.plexus.util.cli.CommandLineException e) {
throw new SurefireBooterForkException("Error while executing forked tests.", e);
}
if (redirectTestOutputToFile) {
// ensure the FileOutputConsumerProxy flushes/closes the output file
try {
out.getOutputConsumer().testSetCompleted();
} catch (Exception e) {
// the FileOutputConsumerProxy might throw an IllegalStateException but that's not of interest now
}
}