Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I exit quietly from Elixir?

Tags:

elixir

Process.exit(self, :normal) does the job, but it prints out ** (EXIT from #PID<0.49.0>) normal. Is there a way to exit without the message?

like image 543
ijt Avatar asked Mar 11 '15 18:03

ijt


1 Answers

It depends on which application you are running. If you are building a script, you can invoke System.halt(0). If you have an application, do not call System.halt(0), as it will shutdown the whole system without considering all other applications. Instead use System.stop(0).

Alternatively, you can call exit(:shutdown) to exit the current process. :shutdown is a common reason for exit in OTP and if you are inside .exs files, it will work just fine too.

like image 77
José Valim Avatar answered Sep 22 '22 17:09

José Valim