[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple non-interactive shell


Hi,
thanks for your help ! However, when I add the while loop (as in the tutorial, the program stops there). Any ideas ? Moreover, I don't really need the result of the remote command for now... (just hope there won't be any errors :) )

Aloys D.


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Le mardi 26 novembre 2019 11:32, <g4-lisz@xxxxxxxxxxxx> a écrit :

> 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



Follow-Ups:
Re: Simple non-interactive shellg4-lisz@xxxxxxxxxxxx
References:
Simple non-interactive shellAloys Delobel <aloysdelobel@xxxxxxxxxxxxxx>
Re: Simple non-interactive shellg4-lisz@xxxxxxxxxxxx
Archive administrator: postmaster@lists.cynapses.org