Hi,

   +-From: campo <[EMAIL PROTECTED]> -------
   |_Date: Wed, 16 Apr 2008 21:50:32 +0100 __
   |
   |Question: Does anyone know what might be wrong or is there any way of
   |altering Exec.java to execute numerous commands in the same session? Any
   |help appreciated.

It is a known problem.  There is a bug in System.in on Windows.
Try the following code on Windows and Unices,

  class foo{
    public static void main(String[] arg){
      try{ 
        System.in.read(new byte[32*1024], 0, 32*1024); 
      }
      catch(Exception e){
        System.out.println(e);
      }
    }
  }

You will get an exception on Windows, but not on Unices.

Anyway, to work around that bug, try following lines
instead of 'channel.setInputStream(System.in);' in Shell.java

      channel.setInputStream(new FilterInputStream(System.in){
          public int read(byte[] b, int off, int len)throws IOException{
            return in.read(b, off, (len>1024?1024:len));
          }
        });

Please note that 'Shell.java' is just an example to demonstrate
how to use shell channel instantly.
In the practical programs, nobody will try
'channel.setInputStream(System.in)'.


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
    +1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to