That's useful and also an opportunity to ask questions. These respawn() functions are recursive and, in particular, tail recursive (or could be assuming no sneaky side effects). So (a) how is the depth of the node stack set, and (b) does node support any tail recursion elimination?
Granted, if I had a process failing that often, I would fix it! On Mar 21, 2012 11:26 PM, "mscdex" <[email protected]> wrote: > On Mar 22, 12:51 am, dshaw <[email protected]> wrote: > > var exec = require('child_process').exec; > > exec's callback is executed when the process exits. spawn() is what > emits the exit event. or instead of using spawn, just call respawn() > inside exec's callback. > > Simplest way to respawn with spawn(): > > var spawn = require('child_process').spawn; > function respawn() { > spawn('myprogram').on('exit', respawn); > } > > Simplest way to respawn with exec(): > > var exec = require('child_process').exec; > function respawn() { > exec('myprogram', respawn); > } > > -- > 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 > -- 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
