> Is it guaranteed that the last callback of a process will be the 
`uv_process_t.exit_cb`? I need to know this to determine when the process 
handles can be safely closed.

You should explicitly close the stdio pipes.

Read callbacks can indeed come in after the exit_cb is fired. Sometimes 
data may still be lingering in the stdout/stderr pipes which will be 
flushed after the exit callback.

You have to realize that there are scenarios in which the pipes stay open 
long after the process exits. This may for example happen when the child 
process creates another process that inherits the child's stdio pipes. The 
grand-child may outlive it's parent.

- Bert

On Monday, July 7, 2014 12:38:27 PM UTC-7, Thiago Arruda wrote:
>
> When a process is spawned with stdout/stderr connected to pipes, there are 
> three associated callbacks:
>
> - One for stdout data
> - One for stderr data
> - One for when the process exits.
>
> When a stream reaches EOF, it's read callback will be invoked with an 
> error set. That means when a process exits, all three callbacks will be 
> invoked.
>
> Is it guaranteed that the last callback of a process will be the 
> `uv_process_t.exit_cb`? I need to know this to determine when the process 
> handles can be safely closed.
>
> Thanks in advance
>
> Thiago.
>

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to