[ https://issues.apache.org/jira/browse/SSHD-1068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lyor Goldstein resolved SSHD-1068. ---------------------------------- Resolution: Information Provided > ChannelExec not showing the output > ---------------------------------- > > Key: SSHD-1068 > URL: https://issues.apache.org/jira/browse/SSHD-1068 > Project: MINA SSHD > Issue Type: Question > Affects Versions: 2.5.1 > Reporter: Arpan > Priority: Minor > > I have just started using apache-mina ssh client and ran into a issue where > the command output is not printing. Here is the sample code - > {code:java} > class LibraryBasicTest { > private static final String USER = "luser"; > private static final String HOST = "192.168.0.179"; > private static final int PORT = 22; > private static final long DEFAULT_CONNECT_TIMEOUT = 3L; > private static final long DEFAULT_AUTH_TIMEOUT = 3L; > private static final long DEFAULT_EXEC_TIMEOUT = 3L; > @Test > void basic_user_pass_ssh_conn_tests() { > SshClient sshClient = SshClient.setUpDefaultClient(); > sshClient.start(); > ClientSession session = null; > try { > session = sshClient.connect(USER, HOST, > PORT).verify(DEFAULT_CONNECT_TIMEOUT, TimeUnit.SECONDS) > .getClientSession(); > session.addPasswordIdentity("P@ssw0rd"); > session.auth().verify(DEFAULT_AUTH_TIMEOUT, > TimeUnit.SECONDS); > > ChannelExec channel = session.createExecChannel("sleep > 2;echo \"Hello World!\" \n"); > channel.setUsePty(true); > channel.setOut(System.out); > channel.setErr(System.err); > channel.open().verify(DEFAULT_EXEC_TIMEOUT, > TimeUnit.SECONDS); > } catch (IOException e) { > e.printStackTrace(); > } finally { > if (null != session) { > try { > session.close(); > } catch (IOException e) { > e.printStackTrace(); > } > } > } > sshClient.stop(); > } > } > {code} > What am I missing here ? > P.S. The below command works though but not planing to use it until it is the > only way. > {code:java}session.executeRemoteCommand("echo \"Hello World!\"");{code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org