-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exit-status returns non-deterministic #114
Comments
seems like a visibility issue - sounds like some of |
The issue still persist and is not fixed using the latest snapshot version. |
ok, reopening |
Hello Session.Command cmd = null;
Session session = ssh.startSession();
cmd = session.exec(shellCommand);
System.out.println("status = " + cmd.getExitStatus());
System.out.println("cmd.getExitSignal() = " + cmd.getExitSignal());
System.out.println("cmd = " + cmd);
LOGGER.debug("{}@{}:# {}", _login, _host, shellCommand);
return cmd.getInputStream(); |
If execute Before Session.Command cmd = null;
Session session = ssh.startSession();
cmd = session.exec(shellCommand);
cmd.close();
if (cmd.getExitStatus() != 0) {
throw new ExecutionException("Shell command " +
"'"+shellCommand+"' on host = "+_host+" exit w
.getExitStatus());
}
LOGGER.debug("{}@{}:# {}", _login, _host, shellCommand); stdout |
Hi,
I just discovered that the exit-status is not always set (in net.schmizz.sshj.connection.channel.direct) , even though the according packets are send by the ssh host. A first evaluation of this points to the StreamCopier (net.schmizz.sshj.StreamCopier) because depending on the call of the copy() function, the exit-status is available or not (see attached logfiles).
Logfile when exit-status is fetched:
Logfile when the exit-status remains "null":
Even though the SSH related RFC (http://www.ietf.org/rfc/rfc4254.txt) only recommends to return the exit-status, an accurate exit-status would be great instead of an null value (when the host has send the packet).
The text was updated successfully, but these errors were encountered: