use of com.jn.langx.commandline.DefaultExecuteResultHandler in project agileway by fangjinuo.
the class SshCommandLineExecutorTest method showResult.
private static void showResult(SshCommandLineExecutor executor) {
DefaultExecuteResultHandler resultHandler = (DefaultExecuteResultHandler) executor.getResultHandler();
if (resultHandler.hasResult()) {
Throwable exception = resultHandler.getException();
if (exception != null) {
logger.error(exception.getMessage(), exception);
} else {
OutputAsStringExecuteStreamHandler output = (OutputAsStringExecuteStreamHandler) executor.getStreamHandler();
String str = output.getOutputContent();
logger.info(str);
}
}
}
Aggregations