Skip to content

Commit

Permalink
Use ensure_started for safer starting
Browse files Browse the repository at this point in the history
  • Loading branch information
trotter committed May 1, 2011
1 parent 537df58 commit 0b21de3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions apps/chloe/src/chloe.erl
Expand Up @@ -11,9 +11,20 @@
%%--------------------------------------------------------------------

start() ->
ok = application:start(inets),
ensure_started(inets),
application:start(chloe).

stop() ->
ok = application:stop(chloe),
application:stop(inets).
application:stop(chloe).

%%--------------------------------------------------------------------
%% Internal functions
%%--------------------------------------------------------------------

ensure_started(App) ->
case application:start(App) of
ok ->
ok;
{error, {already_started, App}} ->
ok
end.

0 comments on commit 0b21de3

Please sign in to comment.