On 25.11.19 12:04, Aloys Delobel wrote: > Hi everybody, > I'm trying to set a simple non-interactive shell, between my program > (which sends commands to the remote shell) and the server. Here's my > program : > [.....] > And the problem is : the line "pass_instruction(channel, MV_FILE, > "example.txt");" works and copy the file, then the > "pass_instruction(channel, MV_FILE, "example2.txt") ;" works according > to the program, but the file is not copied. I don't understand why... > > Thanks for helping ! > Aloys D. > I'm not familiar with libssh and the remote shell... Just some idea: Your pass_instruction function only checks if the write to the server was successfull, but not the result of the remote command. Can it be that remote side waits for a read before it passes the next line to the shell?
The example at http://api.libssh.org/stable/libssh_tutor_shell.html uses some read/write loop, like while (ssh_channel_is_open(channel) && !ssh_channel_is_eof(channel)) { read(...); .... write(...); } Till