Skip to content

Instantly share code, notes, and snippets.

@haitaoyao
Created August 23, 2012 02:25
Show Gist options
  • Save haitaoyao/3431485 to your computer and use it in GitHub Desktop.
Save haitaoyao/3431485 to your computer and use it in GitHub Desktop.
erlang start application and dependencies
start(App) ->
start_ok(App, application:start(App, permanent)).
start_ok(_App, ok) ->
ok;
start_ok(_App, {error, {already_started, _App}}) ->
ok;
start_ok(App, {error, {not_started, Dep}}) ->
ok = start(Dep),
start(App);
start_ok(_App, {error, Reason}) ->
erlang:error({app_start_failed, Reason}).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment