This project is read-only.

Best way to get full results of SshCommand? (and other questions)

May 22, 2014 at 6:07 PM
Edited May 22, 2014 at 6:08 PM
Hello,

What is the best way to get full results of an SshCommand synchronously? i.e. I just want to block until it's done.

Is it just:
var cmd = client.CreateCommand("mycmd");
cmd.Execute();
String result = cmd.Result();
Some other questions:
  1. Does SshCommand.Execute() take care of blocking until the remote command has finished and all data has been received over the network?
  2. Is SshCommand.ExitStatus the traditional process exit code?
  3. It looks like SshCommand.Result and SshCommand.Error represent STDOUT and STDERR respectively. Is this correct?
  4. Can SshCommand.Execute() accept some sort of timeout value?
  5. What is the purpose of the SshCommand.Execute(string) overload? How would/should I use it?
  6. At what point in the process is the SSH command channel destroyed? (even if the overall connection is still alive.)
  7. What is the correct pattern to use if I want to execute multiple commands without needing to set up a full new client connection every time?
Thank you,
David