[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting mkdir command result
[Thread Prev] | [Thread Next]
- Subject: Re: Getting mkdir command result
- From: Nikhil Agrawal <mrnikhilagrawal@xxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 12 Jan 2011 15:13:49 +0530
- To: libssh@xxxxxxxxxx
When using ssh_channel_request_exec, it always returned success even if mkdir fails and no error identified in ssh_get_error. But setting stderr to 1 and parsing returned buffer, resolves my problem. Many Thanks! Regards, Nikhil On Wed, Jan 12, 2011 at 2:35 PM, Aris Adamantiadis <aris@xxxxxxxxxxxx>wrote: > 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 > >
Re: Getting mkdir command result | Aris Adamantiadis <aris@xxxxxxxxxxxx> |
Getting mkdir command result | Nikhil Agrawal <mrnikhilagrawal@xxxxxxxxx> |
Re: Getting mkdir command result | Aris Adamantiadis <aris@xxxxxxxxxxxx> |