<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Digging further, you can try with <b>spawn_link</b>:</div><div><br></div><div><div>1> <b>process_flag</b>(trap_exit, true).</div><div>false</div><div>2> <b>spawn_link</b>('<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>', erlang, display, [nothing]).</div><div><0.44.0></div><div>3></div><div>=ERROR REPORT==== 8-Aug-2014::17:11:51 ===</div><div>** Can not start erlang:display,[nothing] ([link]) on '<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>' **</div><div>3> <b>flush</b>().</div><div>Shell got {'EXIT',<0.44.0>,noconnection}</div><div>ok</div><div>4></div></div><br><div><blockquote type="cite"><div>On Aug 8, 2014, at 17:06, Federico Carrone <<a href="mailto:federico.carrone@gmail.com">federico.carrone@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr"><div><div>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. </div>
<div><br></div><div>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)?</div><div><br></div><div>Regards,</div><div>Federico.</div><div><br></div><div>---<br>
<br>1> spawn('<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>', erlang, display, [nothing]).</div><div><0.43.0></div><div><br></div><div>=ERROR REPORT==== 8-Aug-2014::16:50:52 ===</div><div>** Can not start erlang:display,[nothing] on '<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>' **</div>
</div><div><br></div><div>2> proc_lib:spawn('<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>', erlang, display, [nothing]).</div><div><0.56.0></div><div><br></div><div>3></div><div>=ERROR REPORT==== 8-Aug-2014::16:52:21 ===</div>
<div>
** Can not start proc_lib:init_p,[<0.50.0>,[],erlang,display,[nothing]] on '<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>' **</div><div><br></div><div>4> is_process_alive(spawn('<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>', erlang, display, [nothing])).</div>
<div>true</div><div>5></div><div>=ERROR REPORT==== 8-Aug-2014::16:53:27 ===</div><div>** Can not start erlang:display,[nothing] on '<a href="mailto:this.is@not.a.node">this.is@not.a.node</a>' **</div><div><br></div>-- <br><div dir="ltr"><a href="http://federicocarrone.com/" target="_blank">http://federicocarrone.com/</a><br>
</div>
</div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></div></blockquote></div><br></body></html>