Subject: libssh2_channel_read() blocking in case of a background process

libssh2_channel_read() blocking in case of a background process

From: anirudh nair <anirudh.anu01_at_gmail.com>
Date: Thu, 8 Dec 2011 14:07:32 +0530

Hi all,

I need to execute a remote script as below

//script begins- only psuedo_code

some_process &(as a background process)
if (some_process is up)
echo "Application is running"
exit 1
else
echo "Application not started"
exit 2
endif

//script ends

But I see that libssh2_channel_read() blocks while waiting for
some_process to return.

But If I make it non blocking i.e
libssh2_session_set_blocking(session, 0);

the below code always returns 0
nReturnCode = libssh2_channel_get_exit_status( channel );

Ideally I want the read not to block and at the same time return the
correct return code i.e 1

Hope my problem statement is clear.

How can I go about achieving this requirement?

Thanks
Anirudh

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-12-08