Heiner Steven schrieb:
You may need
     libssh2_channel_get_exit_status(channel);
Heiner

Hello,

Thanks a lot for your answer!
You are right, this works very well. The problem is, that if I call
"libssh2_channel_wait_closed" right before "libssh2_channel_get_exit_status"
the function "libssh2_channel_wait_closed" never returns.
Is it safe to skip "libssh2_channel_wait_closed"?
http://www.libssh2.org/wiki/index.php/Libssh2_channel_wait_closed

Thanks
Markus

What I do so far (simplified):

/* connect... */
LIBSSH2_CHANNEL *channel = libssh2_channel_open_session( connection );
if( channel == NULL )
   return 127;
int rc = libssh2_channel_exec( channel, "ls -l /tmp" );
if( rc != 0 )
   return 127;
for( ;; )
{
   char buffer[0x4000];
   int rc = libssh2_channel_read( channel, buffer, sizeof(buffer) );
   if( rc <= 0 )
       break;
   /* process buffer */
}
int returnvalue = 127;
if( libssh2_channel_close(channel) == 0 )
{
if( libssh2_channel_wait_closed(channel) == 0 ) /* This call never returns */
       returnvalue = libssh2_channel_get_exit_status( channel );
}
/* disconnect... */



------------------------------------------------------------------------------
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to