[erlang-patches] add application:start_all/1-2 (recursive OTP app starting)
Fred Hebert
mononcqc@REDACTED
Thu Jun 20 20:16:11 CEST 2013
This adds two new functions to the application module that will
recursively look for missing dependencies to start the entire dependency
chain of a given application, and then the application itself, if
possible.
Its entire behavior is based on the currently existing 'start/1-2'
functions, which will report dependencies that have not yet been started
and other problems encountered. 'start_all/1-2' will use this
information the way any programmer would manually do it to automate the
process.
This kind of functionality, while not OTP-ish (releases do this start
sequence for the user), is still useful for testing purposes, quick
demonstrations, and programmers who do not wish or know how to use OTP
releases.
The function returns 'ok' for all started or already started
applications, and will return '{error, {AppName, Reason}}' on a failure
to allow users to rapidly know why the function failed.
I decided to call it start_all even though its semantics are somewhat
similar to ensure_start in how it ignores already_started applications,
but am open to changing the name if the OTP team prefers
'ensure_all/1-2' as functions for this module.
Documentation has been added, and so were tests, looking for a few
simple case: simple app, app with a dependency, and apps with a
3rd-level dependency not booting, all locally.
Note that no specific check is made for direct or indirect circular
dependencies between applications, and these will make the function go
in an infinite loop.
git fetch git://github.com/ferd/otp.git start-all
https://github.com/ferd/otp/compare/erlang:maint...start-all
https://github.com/ferd/otp/compare/erlang:maint...start-all.patch
Regards,
Fred Hebert.
More information about the erlang-patches
mailing list