How to kill the erlang program within erlang program? exit/1 command does not behave same as c language standard library exit call.
Asked
Active
Viewed 202 times
5
-
3An Erlang VM is different from a normal C program (or even a Java VM) in that it works like a small operating system. The correct way to stop it is to call init:stop() as Roger noted below. This gives running processes a chance to terminate cleanly, like a Unix "shutdown". An alternative is to call erlang:halt(), but this just stops the Erlang VM immediately, and could cause you to lose data. – RichardC Nov 10 '15 at 10:28
1 Answers
8
init:stop()
(see init:stop/0, /1) or erlang:halt()
(see erlang:halt/0, /1, /2) will stop the node immediately.

Roger Lipscombe
- 89,048
- 55
- 235
- 380
-
5init:stop() is usually the correct thing to do. halt() is much more brutal, but might occasionally be what you want. – RichardC Nov 10 '15 at 10:15