Running code when a script exits

Could put the logic you want to execute on exit in a terminate/2 callback of a process in your app’s sup tree?

We could execute at_exit for System.stop as well… but we do have an issue in that they would be executed way too late in the termination process, when almost everything would be shut down, so it is likely not useful. That’s why System.at_exit is about the script exiting normally.