How to figure out if a command executed using JSch in Java has successfully completed?

Viewed 253

I am not able to figure out whether a command has completed its execution or not before sending the next command using the JSch library in Java.

Code snippet

// Opens a new channel of type 'exec'
Channel channel = sesConnection.openChannel("exec"); 
// sets the command to be executed
((ChannelExec) channel).setCommand(command); 
// Gets an input stream for this channel
InputStream commandOutput = channel.getInputStream(); 
channel.connect();
1 Answers
Related