<p>Hi Yves,</p>
<p>one classic scenario where you have a gen_server that needs to trap exits is a server that wraps around a port program.</p>
<p>If your server starts an external program that it makes available as resource to Erlang, then it will want to know about crashes explicitly, since normal supervision cannot easily deal with restarting something external.</p>
<p>Robby<br>
</p>
<div class="gmail_quote">On Jul 14, 2014 12:59 AM, "Yves S. Garret" <<a href="mailto:yoursurrogategod@gmail.com">yoursurrogategod@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div>Hello,<br><br>I'm looking at some code that was written where a user uses a behaviour of gen_server and then uses a process_flag(trap_exit, true). To me, this seems like a supervisor behaviour would work better.<br>
<br></div>What would be a better approach in this case? To declare this module a supervisor? Is it possible (sensible? logical?) to give the same module gen_server and supervisor behaviours?<br><br></div>Thanks in advance!<br>
</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div>