protected void allocatePTY(Session s) throws ConnectionException, TransportException { // this was set as the default, but it makes output harder to read // and causes stderr to be sent to stdout; // but some systems requiretty for sudoing if (allocatePTY) s.allocatePTY("vt100", 80, 24, 0, 0, Collections.<PTYMode, Integer> emptyMap()); // s.allocatePTY("dumb", 80, 24, 0, 0, Collections.<PTYMode, Integer> emptyMap()); }
@Override public Session create() throws Exception { checkConnected(); session = sshClientConnection.ssh.startSession(); session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of()); return session; }
@Override public Session create() throws Exception { checkConnected(); session = sshClientConnection.ssh.startSession(); session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of()); return session; }
@Override public Session create() throws Exception { checkConnected(); session = sshClientConnection.ssh.startSession(); session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of()); return session; }
@Override public Session create() throws Exception { checkConnected(); session = sshClientConnection.ssh.startSession(); session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of()); return session; }
@Override public Session create() throws Exception { checkConnected(); session = sshClientConnection.ssh.startSession(); session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of()); return session; }
@Override public Session create() throws Exception { checkConnected(); session = sshClientConnection.ssh.startSession(); if (allocatePTY) { session.allocatePTY(TERM, 80, 24, 0, 0, Collections.<PTYMode, Integer> emptyMap()); } return session; }
// Start a new session session = sshClient.startSession(); session.allocatePTY("vt220", 80,24,0,0,Collections.<PTYMode, Integer>emptyMap()); Command cmd = null; String response = null; // your allocating a new session there try (Session session = sshClient.startSession()) { cmd = session.exec("sudo service riak start"); response = IOUtils.readFully(cmd.getInputStream()).toString(); cmd.join(timeout, timeUnit); } finally { if (cmd != null) cmd.close(); }
mockClient.isConnected(); expectLastCall().andReturn(true); mockClient.startSession(); expectLastCall().andReturn(session); session.allocatePTY("vt100", 80, 24, 0, 0, ImmutableMap.<PTYMode, Integer> of()); expectLastCall(); session.exec("some-command"); expectLastCall().andReturn( command );