zane-rl opened a new issue, #358:
URL: https://github.com/apache/mina-sshd/issues/358

   ### Version
   
   2.5.1
   
   ### Bug description
   
   ` // listFolderStructureBySshd("user", "password", "host", 22, 3, "ls -al 
~/.ssh");
       public static void listFolderStructureByJsch(String username, String 
password, String host, int port, String command) throws Exception {
           Session session = null;
           ChannelExec channel = null;
   
           try {
               session = new JSch().getSession(username, host, port);
               session.setPassword(password);
               session.setConfig("StrictHostKeyChecking", "no");
               session.connect();
   
               channel = (ChannelExec) session.openChannel("exec");
               channel.setCommand(command);
               ByteArrayOutputStream responseStream = new 
ByteArrayOutputStream();
               channel.setOutputStream(responseStream);
               channel.connect();
   
               while (channel.isConnected()) {
                   Thread.sleep(100);
               }
   
               String responseString = new String(responseStream.toByteArray());
               System.out.println(responseString);
           } finally {
               if (session != null) {
                   session.disconnect();
               }
               if (channel != null) {
                   channel.disconnect();
               }
           }
       }`
   envirenment:mac os and idea
   
   ### Actual behavior
   
   output null 
   
   ### Expected behavior
   
   `total 96
   drwxr-xr-x   10 boleyn  staff    320 Apr 14 16:11 .
   drwxr-xr-x+ 173 boleyn  staff   5536 Apr 14 18:50 ..
   -rw-------    1 boleyn  staff   1823 Mar 12  2019 id_rsa
   -rw-r--r--    1 boleyn  staff    395 Mar 12  2019 id_rsa.pub
   -rw-r--r--    1 boleyn  staff    887 Jun 21  2021 id_rsa_gitlab
   -rw-r--r--    1 boleyn  staff    222 Jun 21  2021 id_rsa_gitlab.pub
   -rw-------    1 boleyn  staff   1864 Mar 23  2020 identity
   -rw-r--r--    1 boleyn  staff    400 Mar 23  2020 identity.pub
   -rw-------    1 boleyn  staff  10908 Apr 14 16:11 known_hosts
   -rw-r--r--    1 boleyn  staff  10166 Apr 14 16:10 known_hosts.old`
   
   ### Relevant log output
   
   _No response_
   
   ### Other information
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to