use of org.nextprot.api.commons.utils.SystemCommandExecutor in project nextprot-api by calipho-sib.
the class BlastProgram method process.
private O process(List<String> commandLine) throws ExceptionWithReason {
SystemCommandExecutor commandExecutor = new SystemCommandExecutor(commandLine);
try {
commandExecutor.executeCommand();
String stderr = commandExecutor.getLastExecutionStandardError();
if (!stderr.isEmpty()) {
ExceptionWithReason ewr = new ExceptionWithReason();
ewr.getReason().addCause(name + " exception", stderr.replace("\n", " "));
ewr.getReason().setMessage("Error while executing " + name);
throw ewr;
}
return buildOutputFromStdout(commandExecutor.getLastExecutionStandardOutput());
} catch (InterruptedException | IOException e) {
throw new NextProtException("Internal error: cannot process " + name + " command line " + commandLine, e);
}
}
Aggregations