Subject: Re: libssh2_channel_exec() command ok?

Re: libssh2_channel_exec() command ok?

From: Peter Stuge <>
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

Received on 2010-08-04