String line = reader.readLine();
while (cmdCtx.getExitCode() == 0 && !cmdCtx.isTerminated() && line != null) {
if (_logger.isDebugEnabled()) {
_logger.debug(">>> " + line.trim());
}
cmdCtx.handleSafe(line.trim());
line = reader.readLine();
}
} finally {
StreamUtils.safeClose(reader);
cmdCtx.terminateSession();