if (sb.length() > 0) {
channel = sshSession.createChannel("exec", sb.append("\n").toString());
channel.setIn(new ByteArrayInputStream(new byte[0]));
} else {
channel = sshSession.createChannel("shell");
channel.setIn(new NoCloseInputStream(System.in));
((ChannelShell) channel).setPtyColumns(getTermWidth());
((ChannelShell) channel).setupSensibleDefaultPty();
Object ctype = session.get("LC_CTYPE");
if (ctype != null) {
((ChannelShell) channel).setEnv("LC_CTYPE", ctype.toString());