in reply to Problem with using $SIG{__DIE__} to restart program

It's usually better to have a different process act as a "nanny" and just restart your program if it dies. Once nice thing about this is that you can make decisions about restarting (e.g. by checking the exit code, or not restarting if you've already done that N times in M minutes).

There are various ways of doing this on Unix, but I'm not familiar with Windows. If you have a reliable fork(), one way is to just fork your program during startup and have the parent wait() or waitpid() for the child to die and respawn as need.

bluto

  • Comment on Re: Problem with using $SIG{__DIE__} to restart program