Skip to content

Instantly share code, notes, and snippets.

@ericmoritz
Created February 26, 2013 22:01
Show Gist options
  • Save ericmoritz/5042666 to your computer and use it in GitHub Desktop.
Save ericmoritz/5042666 to your computer and use it in GitHub Desktop.
child(SupPid, Child) ->
find_child(
Child,
supervisor:which_children(SupPid)
).
find_child(_, []) ->
{error, not_found};
find_child(Child, [{Child,Pid, _,_}|_]) ->
{ok, Pid};
find_child(Child, [_|Rest]) ->
find_child(Child, Rest).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment