diff options
author | Siri Hansen <[email protected]> | 2016-06-08 13:39:56 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2016-06-08 13:39:56 +0200 |
commit | 41d1444bb13317f78fdf600a7102ff9f7cb12d13 (patch) | |
tree | cc4503dd40ad240c0fe46cc955e7975e8f020e77 /lib/stdlib/src | |
parent | a029b8a7da7d1f6f34275cd209aabb5f8fec25bb (diff) | |
parent | e2577531278c5dde283c4ab7be766d081c363ec3 (diff) | |
download | otp-41d1444bb13317f78fdf600a7102ff9f7cb12d13.tar.gz otp-41d1444bb13317f78fdf600a7102ff9f7cb12d13.tar.bz2 otp-41d1444bb13317f78fdf600a7102ff9f7cb12d13.zip |
Merge branch 'josevalim/supervisor-get-callback-module/PR-1000/OTP-13619'
* josevalim/supervisor-get-callback-module/PR-1000/OTP-13619:
Return callback module in supervisor format_status
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/supervisor.erl | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index a594c66fa7..c81e72689c 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -30,7 +30,7 @@ %% Internal exports -export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3]). + terminate/2, code_change/3, format_status/2]). -export([try_again_restart/2]). %% For release_handler only @@ -264,8 +264,13 @@ cast(Supervisor, Req) -> get_callback_module(Pid) -> {status, _Pid, {module, _Mod}, [_PDict, _SysState, _Parent, _Dbg, Misc]} = sys:get_status(Pid), - [_Header, _Data, {data, [{"State", State}]}] = Misc, - State#state.module. + case lists:keyfind(supervisor, 1, Misc) of + {supervisor, [{"Callback", Mod}]} -> + Mod; + _ -> + [_Header, _Data, {data, [{"State", State}]} | _] = Misc, + State#state.module + end. %%% --------------------------------------------------- %%% @@ -1450,3 +1455,9 @@ report_progress(Child, SupName) -> Progress = [{supervisor, SupName}, {started, extract_child(Child)}], error_logger:info_report(progress, Progress). + +format_status(terminate, [_PDict, State]) -> + State; +format_status(_, [_PDict, State]) -> + [{data, [{"State", State}]}, + {supervisor, [{"Callback", State#state.module}]}]. |