Thanks @josevalim!
However, System.stop/1 has three problems:
- It does not invoke
System.at_exit/1, that is why my “halter” solution above needs to get passed a function. - The script ends printing the noisy “exit” traces I quoted above. Maybe that is cosmetic, but a user does not know if “no process: the process is not alive or…” is a normal message or something to worry about, and in any case the output is not clean as you’d expect from running a program that finishes normally.
- The programmer needs to do this by hand. I am touching a file to finish the script! Alternatively, I could write a signal handler, but all this seems boilerplate for something
mix runshould have builtin in my view.
The question is: mix run starts the application by default, why does not provide a builtin way to cleanly stop the application too?






















