channel.setIn(new NoCloseInputStream(System.in)); channel.setOut(new NoCloseOutputStream(System.out)); channel.setErr(new NoCloseOutputStream(System.err)); WaitableFuture wf = channel.open(); wf.await(); Set<ClientChannelEvent> waitMask = channel.waitFor(Collections.singletonList(ClientChannelEvent.CLOSED), 0L); Integer exitStatus = channel.getExitStatus(); return exitStatus;
@Override public String toString() { return super.toString() + "[" + getSubsystem() + "]"; } }
@Override protected RequestHandler.Result handleInternalRequest(String req, boolean wantReply, Buffer buffer) throws IOException { switch (req) { case "xon-xoff": return handleXonXoff(buffer, wantReply); default: return super.handleInternalRequest(req, wantReply, buffer); } }
channel.setPtyModes(tty); channel.setIn(channelIn); channel.setOut(channelOut); channel.setErr(new ByteArrayOutputStream()); channel.open();
@Override protected Closeable getInnerCloseable() { return builder() .close(super.getInnerCloseable()) .run(toString(), this::closeImmediately0) .build(); }
@Override public void handleFailure() throws IOException { String systemName = getSubsystem(); Date pending = removePendingRequest(Channel.CHANNEL_SUBSYSTEM); if (pending != null) { log.warn("handleFailure({}) subsystem={}, pending since={}", this, systemName, pending); close(true); } }
@Override public void handleFailure() throws IOException { Date pending = removePendingRequest(Channel.CHANNEL_SHELL); if (pending != null) { log.warn("handleFailure({}) pending={}", this, pending); close(true); } } }
public void sendWindowChange(int columns, int lines) throws IOException { sendWindowChange(columns, lines, ptyHeight, ptyWidth); }
@Override public void handleSuccess() throws IOException { String systemName = getSubsystem(); Date pending = removePendingRequest(Channel.CHANNEL_SUBSYSTEM); if (log.isDebugEnabled()) { log.debug("handleSuccess({}) subsystem={}, pending since={}", this, systemName, pending); } }
public SSHClient close() { try { Utils.close(out); channel.close(false); session.close(false); client.stop(); return this; } finally { this.client = null; this.channel = null; this.session = null; this.out = null; } } }
@Override public OutputStream getOutputStream() { return channel.getInvertedIn(); }
@Override public InputStream getInputStream() { return channel.getInvertedOut(); }
@Override default Channel getChannel() { return getClientChannel(); }
@Override public boolean isOpen() { return this.channel.isOpen(); }
@Override public InputStream getErrorStream() { return channel.getInvertedErr(); }
@Override protected Closeable getInnerCloseable() { return builder() .close(super.getInnerCloseable()) .run(toString(), this::closeImmediately0) .build(); }
@Override public String toString() { return super.toString() + "[" + getSubsystem() + "]"; } }
@Override protected RequestHandler.Result handleInternalRequest(String req, boolean wantReply, Buffer buffer) throws IOException { switch (req) { case "xon-xoff": return handleXonXoff(buffer, wantReply); default: return super.handleInternalRequest(req, wantReply, buffer); } }
public void sendWindowChange(int columns, int lines) throws IOException { sendWindowChange(columns, lines, ptyHeight, ptyWidth); }