Expose the SshChannelExitStatus to Shells
I can call Ssh.StartShell to start a shell and then I can execute commands with SendCommand but, I can't tell if the commands were successful because SshChannelExitStatus is not exposed.
-
Adminmartin.vobr (Admin, Rebex) commented
Implemented in build 3479 via Shell.GetExitCode. http://www.rebex.net/ssh-shell.net/history.aspx
-
AdminLukas Pokorny (Admin, Rebex) commented
Thaks for your suggestion! We will add this to the next release, although it is actually not as easy as it sounds:
1. For a command executed using the remote exec functionality (Ssh object's StartCommand method), the exit code can be determined easily from the underlying SSH channel's ExitStatus property
2. For commands executed using a shell session, this is not possible. However, in WellKnownShell mode, we can retrieve the process exit code from a shell's environment variable.
3. For commands executed using a shell session in Prompt mode, there is no reliable way to retrieve the exit code. In this mode, we will simply not support this functionality. This also means that this won't be supported in Rebex Telnet component.