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

Re: Getting mkdir command result


Le 12/01/11 08:08, Nikhil Agrawal a écrit :
> Hi,
> 
> I am using libssh to run mkdir on remote machine. In case mkdir fails, I
> want to receive/get error in my client so i can take measures. I am
> getting OK as return code in all cases and don’t get to know if mkdir
> successfully ran or not. Please Suggest.
> 
> Thanks!
> 
> 
Hi Nikhil,

I suggest that you check the return code, either using Rocky's method,
or by using ssh_channel_get_exit_status() (you may have to wait that the
channel is closed for this).
You can check in the stderr stream
(ssh_channel_read(channel,dest,len,1); since the error message of mkdir
will be written to stderr and not stdout.

Another solution, that I really advise you use, is to use the sftp
subsystem which has reliable functions to manipulate remote filesystems.

Kind regards,

Aris

Follow-Ups:
Re: Getting mkdir command resultNikhil Agrawal <mrnikhilagrawal@xxxxxxxxx>
References:
Getting mkdir command resultNikhil Agrawal <mrnikhilagrawal@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org