Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Unable to show result if it has more than a line.

$
0
0
Hi,

First of all thanks for developing such a great library for SSH.

I am facing a problem whereby I am not able to show the result if I execute command such as "ls", which will return result with more than a line. The result would be blank even though the ExitStatus is 0.
However, it works perfectly if the command (i.e. "pwd" or "date") only returns one line.

Below is the code snippet which I am using currently:
using (SshClient client = new SshClient("host", "username", "password"))
{
  client.Connect();

  SshCommand cmd = client.CreateCommand("ls"); //works perfectly if substitutes "ls" with "pwd" or "date" which will only return result with one line.

  cmd.Execute();

  string result = cmd.Result;
  Console.WriteLine(result);

  client.Disconnect();
}
I would very appreciate if anyone of you could enlighten me so that the problem of displaying multiple line of result could be solved.

Thanks in advance. :)

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>