Hi !
Not work in Delphi 6 and Delphi 2007 with last SecureBridge.
Writelog ('Start');
ScSSHClient.Connect;
ScSSHShell.Nonblocking:=false;
ScSSHShell.Connect;
ScSSHShell.WriteString('command1'+#10#13);
Writelog(ScSSHShell.ReadString);
Writelog ('pass1');
ScSSHShell.WriteString('command2'+#10#13);
Writelog(ScSSHShell.ReadString);
Writelog ('pass2');
ScSSHShell.WriteString('command3'+#10#13);
Writelog(ScSSHShell.ReadString);
Writelog ('pass3');
In LogFile
2008-09-23 11:56:43 Start
2008-09-23 11:56:43 The prompt from a server instead of result of the command
2008-09-23 11:56:43 pass1
2008-09-23 11:56:43 Why empty ?
2008-09-23 11:56:43 pass2
2008-09-23 11:56:43 Why empty ?
2008-09-23 11:56:43 pass3
In NonBlocking-mode all works. But the result of performance of commands is deduced as follows
Writelog ('Start');
ScSSHClient.Connect;
ScSSHShell.Nonblocking:=true;
ScSSHShell.Connect;
ScSSHShell.WriteString('command1'+#10#13);
Writelog ('pass1');
ScSSHShell.WriteString('command2'+#10#13);
Writelog ('pass2');
ScSSHShell.WriteString('command3'+#10#13);
Writelog ('pass3');
ScSSHShellOnAsyncReceive Writelog(ScSSHShell.ReadString);
In LogFile
2008-09-23 11:56:43 Start
2008-09-23 11:56:43 pass1
2008-09-23 11:56:43 pass2
2008-09-23 11:56:43 pass3
2008-09-23 11:56:43 result of performance of commands
It is necessary for me to see result of performance of each command, instead of the common result of performance of all commands
Problem in SSHShell
The problem is that the TScSSHShell.ReadString method returns not the result of command execution, but data received from server at this moment. This happens because TScSSHShell does not know about the time the command was executed and the size of result data.
To get all result data you can make a delay, or you can learn the time of finishing command execution by reading a prompt line you can access by calling ReadString more than one times.
To get all result data you can make a delay, or you can learn the time of finishing command execution by reading a prompt line you can access by calling ReadString more than one times.