if i'm not totally wrong this should be it: - 'error' is emited when something of this gone wrong: spawning, killing or messaging. check err.syscall for 'kill', 'spawn' or 'write' (it's in the code, should be in docs) - 'exit' is emited when the child exited by himself been killed by parent. check the param code for null. this is the normal case. - 'close' is emited when stdio streams are closed, so the child can't receive any data via stdio. you can handle that case then, if it's important to you.
it very similar with http, where you have to watch for 'error' catching protokoll/connection errors separated from application errors indicated by http statuscodes. For child process, error means something is wrong with the infrastructure, exitcode and signals mean child code has finished. Am Mittwoch, 12. Juni 2013 08:45:28 UTC+2 schrieb Benjamin Pasero: > > Hi, > > I am currently migrating our application from node 0.8 to 0.10 and would > like to ask around the changes in how process behave in 0.10. Let's say I > am spawning a process from my node application. I will have to attach two > listeners (error and exit) to handle this child process lifecycle. Now, how > would I be able to find out if a process has finished? I see that the error > event can be triggered if the spawn failed, so this would mean my exit > handler is never called. On the other hand, I might also get an error event > if sending a message failed or killing failed, so I would still get an exit > event. Third, I could add a listener for 'close', but I am not sure under > which condition that is fired (e.g. also in error case?). > > This makes it very hard to really handle the case where the process has > finished, either through an error condition or normally. > > Thanks for clarification, > Ben > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
