if ( systPropsFile != null )
{
cli.createArg().setFile( systPropsFile );
}
ThreadedStreamConsumer threadedStreamConsumer = new ThreadedStreamConsumer( forkClient );
if ( forkConfiguration.isDebug() )
{
System.out.println( "Forking command line: " + cli );
}
RunResult runResult = null;
try
{
final int timeout = forkedProcessTimeoutInSeconds > 0 ? forkedProcessTimeoutInSeconds : 0;
final int result =
CommandLineUtils.executeCommandLine( cli, testProvidingInputStream, threadedStreamConsumer,
threadedStreamConsumer, timeout, inputStreamCloser );
if ( result != RunResult.SUCCESS )
{
throw new SurefireBooterForkException( "Error occurred in starting fork, check output in log" );
}
}
catch ( CommandLineTimeOutException e )
{
runResult = RunResult.timeout(
forkClient.getDefaultReporterFactory().getGlobalRunStatistics().getRunResult() );
}
catch ( CommandLineException e )
{
runResult =
RunResult.failure( forkClient.getDefaultReporterFactory().getGlobalRunStatistics().getRunResult(), e );
throw new SurefireBooterForkException( "Error while executing forked tests.", e.getCause() );
}
finally
{
threadedStreamConsumer.close();
if ( inputStreamCloser != null )
{
inputStreamCloser.run();
ShutdownHookUtils.removeShutdownHook( inputStreamCloserHook );
}