nesquena/backburner — pull request #45 by ryanjohns (2013-07-04 08:46:40+00:00)
Title: More graceful shutdown using Kernel.exit and rescuing SystemExit.

Using `Kernel.exit!` causes a few unexpected behaviors. If you run `Backburner.work` from a rails console and then kill it with Ctrl+C, the console session shouldn't also be killed (you currently get booted back to the terminal). Also, if you wrap everything up with the popular daemons gem or role your own wrapper script, any `at_exit` hooks will not run, so tasks like pid file cleanup don't work. This changes to using `Kernel.exit` and rescues the ensuing `SystemExit` exception allowing the work loop to exit gracefully.