Add application:get_supervisor/1
It returns the Pid of the supervisor running at the root of the given application.
This allows tools for introspection and debugging to print supervision trees without relying on private APIs.
CT Test Results
2 files 65 suites 55m 25s :stopwatch: 1 322 tests 1 181 :heavy_check_mark: 140 :zzz: 1 :x: 1 477 runs 1 305 :heavy_check_mark: 171 :zzz: 1 :x:
For more details on these failures, see this check.
Results for commit 26237d26.
:recycle: This comment has been updated with latest results.
To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.
See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.
Artifacts
// Erlang/OTP Github Action Bot
@josevalim If you used the name application:get_root_process/1 the concept would be more general because it looks like there isn't a requirement for the root process to be a supervisor. It would also be helpful if an application:get_group_leader/1 function existed too (just a call to application_controller:get_master/1).
I am almost sure it has to be a supervisor and part of the tooling assumes so. To quote the docs for the start/2 callback:
The function is to return {ok,Pid} or {ok,Pid,State}, where Pid is the pid of the top supervisor and State is any term.
in any case, I will be glad to change the name anytime. :)
Maybe get_top_supervisor.