child_spec should be a valid child specification as detailed in the “Child specification” section of the documentation for Supervisor. The child process will be started as defined in the child specification.
Can you show your Hangman.Server code? Also what is the return value of start_child?
Sure @axelson , start_child returns a pid as expected and everything seems to be working fine, all the childs launched this way work without a problem. I just don’t see them on the observer application tree…
This is the Hangman.Server code:
defmodule Hangman.Server do
alias Hangman.Game
use GenServer
def start_link(_) do
GenServer.start(__MODULE__, nil)
end
def init(_) do
{:ok, Game.new_game()}
end
def handle_call({:make_move, guess}, _from, game) do
{game, tally} = Game.make_move(game, guess)
{:reply, tally, game}
end
def handle_call({:tally}, _from, game) do
{:reply, Game.tally(game), game}
end
end
And this is my application entry point:
defmodule Hangman.Application do
use Application
def start(_type, _args) do
options = [
name: Hangman.Supervisor,
strategy: :one_for_one
]
DynamicSupervisor.start_link(options)
end
end
Can you please elaborate on that? On the old code that I had, using Supervisor and :simple_one_for_one strategy they showed up on the tree, only after converting to DynamicSupervisor I do not found them on the tree anymore…