Subject: Re: libssh2_channel_exec() command ok?

Re: libssh2_channel_exec() command ok?

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 4 Aug 2010 02:45:52 +0200

vicent roca daniel wrote:
> libssh2_channel_exec() always returns 0 when I executed it.

That means that the server forked a process which will try to execute
the specified command.

> It doesn mather if i put libssh2_channel_exec("ls)
> o libssh2_channel_exec("blahblablah").
>
> I'd like to know if the command is executed. Is possible??

Look for the exit-status message from the server. See
libssh2_channel_get_exit_status(). Note that you only get the exit
status *after* the command has exited on the server. You need to read
from the channel until it returns an error, and *then* check the exit
status.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-08-04