Subject: Re: How do i know that process has completed?

Re: How do i know that process has completed?

From: Steven Ayre <steveayre_at_gmail.com>
Date: Wed, 5 Oct 2011 23:06:16 +0100

Pavel,

You can however choose to do a nonblocking read and then read from
both stdout and stderr. That'll return immediately if no data is
available so you won't get stuck on a read from stdout if there's no
data available.

libssh2_poll() can let you know that there's stdout(IN) and stderr
(EXT) data available, and that the command has finished
(CHANNEL_CLOSED). It's depreciated now though.

It seems the new idea is to do a select() or poll() on the socket,
then do a nonblocking read of both stdout and stderr. Can someone
clarify if that's correct please?

-Steve

On 5 October 2011 22:57, Peter Stuge <peter_at_stuge.se> wrote:
> Pavel Strashkin wrote:
>> Oh, so, for an example, if some application prints to stdout and
>> stderr both, and i'm reading _only_ from stdout (and waiting for EOF),
>> i can get stuck just because there is a data in stderr and i have to
>> read it, but i don't?
>
> Yes.
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-10-06