1. 4

  2. 3

    Alternatively, and a better solution, is that we never call “exit” inside an “at_exit” block and we make sure that all SystemExit rescue blocks and at_exit blocks are used with great caution and echo the original exit status when necessary.

    Exactly! The purpose of an at_exit block is to allow you to do something before exiting. You don’t have to exit again.