<div class="gmail_quote"><div>Just a thought: instead of trying to pattern match all the possible responses from anything that returns {ok, arg0, arg1,...,argN}, how about using element()?<br><br>e.g.<br> <br>
<span style="font-family: courier new,monospace;">start_child(Id, Args) -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> case supervisor:start_child(work_super,</span><span style="font-family: courier new,monospace;"><br>
{Id, {work, start_link, Args},</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> transient, 60*1000, worker, [work]}) of</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> T when T =:= ok; element(1, T) =:= ok -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ok;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> {error, {already_started, _Child}} -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ok;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Error -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Error</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> end.</span><br style="font-family: courier new,monospace;">
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
start_child(Id, Args) -><br>
case supervisor:start_child(work_super,<br>
{Id, {work, start_link, Args},<br>
transient, 60*1000, worker, [work]}) of<br>
{ok, _Child} -><br>
ok;<br>
{ok, _Child, _Info} -><br>
ok;<br>
{error, {already_started, _Child}} -><br>
ok;<br>
Error -><br>
Error<br>
end.<br>
</blockquote></div><br>