public int waitFor() throws InterruptedException { return process.waitFor(); }
public int waitFor() throws InterruptedException { return process.waitFor(); }
@Override protected final void onAfterProcessStart(ProcessControl process, IRuntimeConfig runtimeConfig) throws IOException { ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor(successMessage(), knownFailureMessages(), StreamToLineProcessor.wrap(outputConfig.getOutput())); Processors.connect(process.getReader(), logWatch); Processors.connect(process.getError(), StreamToLineProcessor.wrap(outputConfig.getError())); logWatch.waitForResult(getConfig().timeout().getStartupTimeout()); if (logWatch.isInitWithSuccess()) { setProcessId(Mongod.getMongodProcessId(logWatch.getOutput(), -1)); } else { String failureFound = logWatch.getFailureFound(); if (failureFound==null) { failureFound="\n" + "----------------------\n" + "Hmm.. no failure message.. \n" + "...the cause must be somewhere in the process output\n" + "----------------------\n" + ""+logWatch.getOutput(); } try { // Process could be finished with success here! In this case no need to throw an exception! if(process.waitFor() != 0){ throw new IOException("Could not start process: "+failureFound); } } catch (InterruptedException e) { throw new IOException("Could not start process: "+failureFound, e); } } }