Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot spawn an erlang supervisor from the shell
    primarykey
    data
    text
    <p>I've implemented a gen_server and supervisor: <code>test_server</code> and <code>test_sup</code>. I want to test them from the shell/CLI. I've written their <code>start_link</code> functions such that their names are registered locally.</p> <p>I've found that I can spawn the <code>test_server</code> from the command line just fine, but a spawned <code>test_sup</code> does not allow me to interact with the server at all.</p> <p>For example, I can spawn a <code>test_server</code> by executing:</p> <pre><code>1&gt; spawn(test_server, start_link, []). &lt;0.39.0&gt; 2&gt; registered(). [...,test_server,...] </code></pre> <p>I can interact with the server, and everything appears fine.</p> <p>However, if I try to do the same thing with <code>test_sup</code>, no new names/Pids are registered in my "CLI process" (using <code>registered/0</code>). My <code>test_server</code> appears to have been spawned, but I cannot interact with it (see Lukas Larsson's comment about SASL to see why this is true).</p> <p>I'd assume I coded an error in my supervisor, but this method of starting my supervisor works perfectly fine:</p> <pre><code>1&gt; {ok, Pid}= test_sup:start_link([]). {ok, &lt;0.39.0&gt;} 2&gt; unlink(Pid). true 3&gt; registered(). [...,test_server,test_sup,...] </code></pre> <p>Why is it that I can spawn a gen_server but not a supervisor?</p> <hr> <p><strong>Update</strong></p> <p>The code I'm using can be found in <a href="https://stackoverflow.com/questions/2775114/erlang-otp-supervisor-crashing">this post</a>. I'm using <code>echo_server</code> and <code>echo_sup</code>, two very simple modules.</p> <p>Given that code, this works:</p> <pre><code>spawn(echo_server, start_link, []). </code></pre> <p>and this does not:</p> <pre><code>spawn(echo_sup, start_link, []). </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload