final Session session = ssh.startSession();
try {
String command = tavernaCommand.replace("%%inputdoc%%", inputDocPath)
.replace("%%outputdoc%%", outputDocPath).replace("%%workflow%%", workflowPath)
.replace("%%working_dir%%", workingDir);
final Command cmd = session.exec(command);
cmd.join(commandTimeout, TimeUnit.SECONDS);
if (!cmd.getExitStatus().equals(0)) {
String stderr = IOUtils.readFully(cmd.getErrorStream()).toString();
LOG.error("Error executing workflow: " + stderr);
throw new TavernaExecutorException("Error executing workflow: " + stderr);
}
LOG.debug("Executed workflow with command " + command);