emulator exit
Serge Aleynikov
serge@REDACTED
Thu Aug 4 15:42:41 CEST 2005
Thanks, I seemed to have missed this one in the docs. Is the proper way
of shutting down the emulator cleanly with an exit code the following?
1> F = fun(N) -> init:stop(), erlang:halt(N) end.
#Fun<erl_eval.20.102880425>
2> F(100).
~>echo $?
100
Is it guaranteed that the erlang:halt/1 call will be executed before the
emulator exits as a result of the init:stop() call?
Serge
Rikard Johansson wrote:
>
> Actually there is a erlang:halt/1 which take the wanted exit code
> (integer()) as argument.
>
> 1> erlang:halt(11).
> [rikard@REDACTED rikard]$ echo $?
> 11
>
> Best regards,
>
> /Rikard
>
> Serge Aleynikov wrote:
>
>> I need to be able to set the exit code at completion of the emulator
>> process, so that I can distinguish from the OS whether the emulator
>> finished with reasons other than 'normal' or 'shutdown'. Is there a
>> way to do that?
>>
>> erlang:halt(), init:stop(), etc. don't seem to have such an option.
>>
>> Thanks.
>>
>> Serge
More information about the erlang-questions
mailing list