[erlang-questions] Fwd: Report errors when using "-detached" option

Nicolas Niclausse nicolas@REDACTED
Fri Nov 14 16:03:11 CET 2008

ERLANG ecrivait le 14.11.2008 15:32:
> Hi Nicolas,
>>>> This is indeed a real problem. If daemon startup fails, you typically
>>>> want to indicate that through a call to exit(error_code) so that the
>>>> invoker can check $?
>>> Hmmm. Calling "exit(error_code)" isn't reported to the invoker.
>>> So $? always equals to 0.
>>> Is this an expected behaviour of calling "exit(error_code)" when using
>>> "-detached" flag.
>> halt(error_code) works.
> No, It doesn't.

ok, maybe i misunderstand the question; for the "status checker", halt can
be useful to report a specific error code to the calling process:

Erlang (BEAM) emulator version 5.6.1 [source] [async-threads:0] [hipe]

Eshell V5.6.1  (abort with ^G)
1> halt(4).
>echo $?


More information about the erlang-questions mailing list