I did, however, run into a problem where it appears that the state of the session is not preserved between calls. I will follow this up on the Codeplex page.
The following test fails:
[TestMethod] public void ShouldMaintainSessionStateAcrossCommands() { using (SshClient client = new SshClient("sssssss", "uuuuuuu", "ppppppp")) { client.Connect(); client.RunCommand("cd /tmp"); string result = client.RunCommand("pwd").Result; Assert.AreEqual("/tmp", result); } }
EDIT: This is the issue I logged and the developer's response. It seems that this behaviour is "by design", which unfortunately means that there will not be a 'fix'.
The workaround would be to run all dependent commands separated by semicolons, although this is quite limiting in some situations.
0 comments:
Post a Comment