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

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

From: Henrik Nordström <henrik_at_henriknordstrom.net>
Date: Fri, 09 Dec 2011 10:45:33 +0100

fre 2011-12-09 klockan 14:11 +0530 skrev anirudh nair:

> My only question is why is does libssh2_channel_read() wait even
> though the script has returned?

Did you see my response earlier?

The server only closes the channel when it is no longer in use. Your
background started application keeps the channel open as it's attached
to stdin/stdout/stderr of the application.

You need to adjust how you start the background application to make sure
to detach it from stdin/stdout/stderr.

   some_program </dev/null >/dev/null 2>&1 &

Regards
Henrik

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