0
当使用SharpSSh和SshExec类时,我无法使RunCommand正常工作,它始终返回一个空字符串。当我调试SharpSsh库时,它在尝试从流中读取命令时返回-1。它在我在同一个库中使用sftp类时起作用,但该类不支持我需要的所有ftp命令。SharpSSh:SshExec中的RunCommand始终返回一个空字符串
这是一个标准的例子,我不能让这个产生正确的结果要么
SshConnectionInfo input = Util.GetInput();
SshExec exec = new SshExec(input.Host, input.User);
if(input.Pass != null) exec.Password = input.Pass;
if(input.IdentityFile != null) exec.AddIdentityFile(input.IdentityFile);
Console.Write("Connecting...");
exec.Connect();
Console.WriteLine("OK");
while(true)
{
Console.Write("Enter a command to execute ['Enter' to cancel]: ");
string command = Console.ReadLine();
if(command=="")break;
string output = exec.RunCommand(command);
Console.WriteLine(output);
}
Console.Write("Disconnecting...");
exec.Close();
Console.WriteLine("OK");
我如何能得到RunCommand函数来运行一些命令任何想法? 感谢您的帮助:)