Trying to use Tamir.SharpSsh.SshExec to execute a longer running (~30sec) sh script. (The script runs well on the target machine.) After ~12sec the RunCommand call returns with code -1. It looks like a timeout, but I could not figure out how to configure it.
Here is a code that I use:
var ssh = new SshExec("mylinux", "myuser", "mypassword");
ssh.Connect(22);
string stdOut = "", stdErr = "";
int processExitCode = ssh.RunCommand("./longrunning.sh", ref stdOut, ref stdErr);
After some debugging it seems that the RunCommand method has a bug: if the std input stream gets empty (because the script does not output anything for a longer time) it returns, even though the script is still running.
As a workaround, you can write a fixed RunCommand method on a derived class and do an active waiting for the m_channel.isClosed()
become true before reading the streams.