StatusCode.aml 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <topic id="8fdc3979-5d00-4749-8dd4-a0e66d14a976" revisionNumber="1">
  3. <developerWhitePaperDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
  4. <title>Execution errors</title>
  5. <content>
  6. When command is executed you can retrive command execution exit status by accessing <codeEntityReference>P:Renci.SshNet.SshCommand.ExitStatus</codeEntityReference> property.
  7. <para>See examples below:</para>
  8. <codeExample>
  9. <list class="ordered">
  10. <listItem>
  11. <para>Display exit status when command is executed.</para>
  12. <code language="cs">
  13. using (var client = new SshClient("host", "username", "password"))
  14. {
  15. client.Connect();
  16. var cmd = client.RunCommand("exit 128");
  17. cmd.Execute();
  18. Console.WriteLine(cmd.ExitStatus); // Should display 128
  19. client.Disconnect();
  20. }
  21. </code>
  22. </listItem>
  23. </list>
  24. </codeExample>
  25. </content>
  26. <relatedTopics>
  27. <codeEntityReference>P:Renci.SshNet.SshCommand.ExitStatus</codeEntityReference>
  28. <codeEntityReference>T:Renci.SshNet.SshCommand</codeEntityReference>
  29. </relatedTopics>
  30. </developerWhitePaperDocument>
  31. </topic>