def init(:ok) do
children = [ worker(Registry, []) ]
supervise children, strategy: :simple_one_for_one
end
-------------
iex(1)> {:ok,s} = Ae.Supervisor.start_link
{:ok, #PID<0.91.0>}
iex(2)> import Supervisor.Spec
nil
iex(3)> Supervisor.start_child s, worker(Registry,[[name: :reg2]])
{:error,
{:EXIT,
{:badarg,
[{:erlang, :apply,
[Registry, :start_link,
{Registry, {Registry, :start_link, [[name: :reg2]]}, :permanent, 5000,
:worker, [Registry]}], []},
{:supervisor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 359]},
{:supervisor, :handle_call, 3, [file: 'supervisor.erl', line: 384]},
{:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 629]},
{:gen_server, :handle_msg, 5, [file: 'gen_server.erl', line: 661]},
{:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}}
iex(4)> Supervisor.which_children s
[]
--------
If it is :one_for_one ... I need name to start the Registry (by design).
iex(1)> {:ok,s} = Ae.Supervisor.start_link
** (EXIT from #PID<0.98.0>) shutdown: failed to start child: Registry
** (EXIT) {:err, "You need to specify :name to start a new registry"}