IOUtils.readFully(cmd.getInputStream()) blocks promgram continue to execute
carlwang87 opened this issue · comments
carlwang87 commented
Currently, Use Copssh(Copssh_5.0.0_Free) as ssh server, Copssh only configs allow linux shell. Copssh is installed on windows 10.
Code:
final SSHClient ssh= getSshClient(hostname, port, username, password);
String result = StringUtils.EMPTY;
try {
Session session = ssh.startSession();
session.allocateDefaultPTY();
try {
Session.Command cmd = session.exec("ls");
result = IOUtils.readFully(cmd.getInputStream()).toString();
Integer exitStatus = cmd.getExitStatus();
} finally {
session.close();
}
when debug to result = IOUtils.readFully(cmd.getInputStream()).toString();
, the program seems to be block by this line code, no error, no exception.
But when change the Copssh to linux shell and Sftp, it works well.
Have anyone encountered this issue?
carlwang87 commented
- linux shell and Sftp
log in Copssh server:
2023.05.27 04:37:09 - Starting session: command for user from 192.168.1.1 port 14390
- linux shell
log in Copssh server:
2023.05.27 04:35:30 - Starting session: forced-command (config) '/bin/bash --login -i' for user from 192.168.1.1 port 14118
Why the logs is different?
Jeroen van Erp commented
I think you would better ask in the CopSSH forum/issuetracker/whatever... This is not an sshj problem.