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

Federico Carrone <>
Fri Aug 8 22:06:54 CEST 2014


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140808/4b7f01ff/attachment.html>


More information about the erlang-questions mailing list