tracking failures in supervisor:start_link

Samuel Rivas samuel@REDACTED
Fri Jan 27 15:13:12 CET 2006


If any of the child processes dies in the init phase when a supervisor is
created with start_link, the supervisor terminates itself with the
reason shutdown. I'd prefer the exit message to propagate untouched, so
I need to know the initial exit reason.

The only way I came up with is creating the supervisor with an empty
child list, starting the children afterwards with the start_child
function. That way the supervisor returns {error, Reason} if something
fails in the children's init functions. This is not perfect since I
cannot know whether the child process died or returned {error, Reason}
but is better than the initial case.

Any cleaner way to do that?

Thanks in advance.

More information about the erlang-questions mailing list