SSH2ConsoleRemote class closing output stream

Michael Montenegro zeusrr at yahoo.com
Tue Feb 14 06:11:49 MET 2006


Why does the command method of the SSH2ConsoleRempote class
close the outputstream after the command is executed? 
Subsequent calls to the command method do not allow me to read
the outputstream because the previous call closed the stream. 
Even worse, if I provide System.out or a servlet output stream,
this method will close the stream meaning no output can go to
these streams and no html can be returned after the command
method is called. 

I see that the docs state to reinitialize the session instance
for multiple calls to the command method but this did help
because once the System.out or servlet output streams are
closed, they can not be reopened further in the class. Also
there is an additional performace hit in this additional object
instanciation.

I have fixed the output stream from closing by removing the
stdout.close() statement in the rxClose method of
SSH2SessionChannel class.  It seems to be keeping the
outputstream open now and I can get the command output from
sebsequent calls to the command method in my class. I also can
reuse the console object and just call the command method again
from this same console object.  Will this modification affect
anything that I am not expecting?

Michael




More information about the Mindterm-users mailing list