Supervisor.start_child
start_child
, go back to Supervisor module for more information.
Specs
start_child( supervisor(), :supervisor.child_spec() | {module(), term()} | module() ) :: on_start_child()
Adds a child specification to supervisor
and starts that child.
child_spec
should be a valid child specification. The child process will
be started as defined in the child specification.
If a child specification with the specified ID already exists, child_spec
is
discarded and this function returns an error with :already_started
or
:already_present
if the corresponding child process is running or not,
respectively.
If the child process start function returns {:ok, child}
or {:ok, child, info}
, then child specification and PID are added to the supervisor and
this function returns the same value.
If the child process start function returns :ignore
, the child specification
is added to the supervisor, the PID is set to :undefined
and this function
returns {:ok, :undefined}
.
If the child process start function returns an error tuple or an erroneous
value, or if it fails, the child specification is discarded and this function
returns {:error, error}
where error
is a term containing information about
the error and child specification.