[erlang-questions] How to detect that spawn/4 did not work

Federico Carrone <>
Fri Aug 8 22:12:51 CEST 2014


Well with spawn link it generates an ** exception exit: noconnection.
However I still think it is strange that spawn/4 returns a Pid even when it
is not working.


On Fri, Aug 8, 2014 at 5:06 PM, Federico Carrone <
> wrote:

> How can we detect that spawn/4 did not work (network split, host down,
> etc)? We get an error report but the function returns an invalid Pid and it
> is not possible to know if it is a real one or not.
>
> Why does it return a pid even if it did not work and if it can detect the
> error (since it generated an error report)?
>
> Regards,
> Federico.
>
> ---
>
> 1> spawn('', erlang, display, [nothing]).
> <0.43.0>
>
> =ERROR REPORT==== 8-Aug-2014::16:50:52 ===
> ** Can not start erlang:display,[nothing] on '' **
>
> 2> proc_lib:spawn('', erlang, display, [nothing]).
> <0.56.0>
>
> 3>
> =ERROR REPORT==== 8-Aug-2014::16:52:21 ===
>  ** Can not start proc_lib:init_p,[<0.50.0>,[],erlang,display,[nothing]]
> on '' **
>
> 4> is_process_alive(spawn('', erlang, display,
> [nothing])).
> true
> 5>
> =ERROR REPORT==== 8-Aug-2014::16:53:27 ===
> ** Can not start erlang:display,[nothing] on '' **
>
> --
> http://federicocarrone.com/
>



-- 
http://federicocarrone.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140808/50b8541b/attachment.html>


More information about the erlang-questions mailing list