The Jsch 1.46 Exec demo isn't working for me, in that output of the
remote-execd-cmd (pwd) is getting lost. I can see it if I print the raw
buffers, but my InputStream has gotten the output  only once out of 30
tries. Also the program exits after the exec is done and before the rest
of the demo program's main() can run,  even though I can't find any
System.exit's in the jsch code. Example code and output below.

 

Has anyone gotten the Exec functionality to work?

 

Thanks,

Bill

 

Code from Exec.java, with printlns added:

 

      byte[] tmp=new byte[1024];

      while(true){

        System.out.println("=========== get " + in.available() + "
cclosed " + channel.isClosed()); // normally 0/false

 

        while(in.available()>0){

          int i=in.read(tmp, 0, 1024);

          System.out.println("got " + i);

          if(i<0)break;

          System.out.print(new String(tmp, 0, i));

        }

        if(channel.isClosed()){

          System.out.println("### exit-status:
"+channel.getExitStatus()); // not printed

          break;

        }

        try{Thread.sleep(100);}catch(Exception ee){}

      }

System.out.println("disconnecting"); // not printed

      channel.disconnect();

      session.disconnect();

    }

 

Result:

 

Session.read()

ChannelExec start() cmd pwd

RequestExec.request() written ok

=========== get 0 cclosed false

=========== get 0 cclosed false

=========== get 0 cclosed false

Session.read() **if I print the buffer here, I can see the result of
pwd**

Session.run() got exit-status: 0

Session.read()

Session.read()





---------------------------------------------------------------------------------
The information transmitted in this email is intended only for the person or 
entity to which it is addressed, and may contain material confidential to Xoom 
Corporation, and/or its subsidiary, BuyIndiaOnline.com Inc.  Any review, 
retransmission, dissemination or other use of, or taking of any action in 
reliance upon, this information by persons or entities other than the intended 
recipient(s) is prohibited.   If you received this email in error, please
 contact the sender and delete the material from your files.
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to