aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wx_object.erl
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2010-05-09 12:19:16 -0400
committerRaimo Niskanen <[email protected]>2010-05-27 16:53:24 +0200
commitdab11bf07c66e1f119cc5d6198c8e90c5a02219e (patch)
treec4d69fedca3ab23224239ee2fc058867f08afe2b /lib/wx/src/wx_object.erl
parent02e434b8befb2696adc98f23bcc195e1ae0539c3 (diff)
downloadotp-dab11bf07c66e1f119cc5d6198c8e90c5a02219e.tar.gz
otp-dab11bf07c66e1f119cc5d6198c8e90c5a02219e.tar.bz2
otp-dab11bf07c66e1f119cc5d6198c8e90c5a02219e.zip
handle {global, term()} names in format_status/2
The gen_fsm, gen_server, and wx_object format_status implementations fail to handle global names of the form {global, term()} where term() is something other than an atom, pid, or list. Change these format_status implementations to treat names that are atoms, pids, or lists as before, but for all other terms, set the header property of the function return value to a tuple whose first element is a string describing the return value and whose second element is the name term. Add unit tests for gen_server and gen_fsm to verify sys:get_status calls work successfully for globally registered instances.
Diffstat (limited to 'lib/wx/src/wx_object.erl')
-rw-r--r--lib/wx/src/wx_object.erl15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/wx/src/wx_object.erl b/lib/wx/src/wx_object.erl
index 71041ff558..bfd38960dd 100644
--- a/lib/wx/src/wx_object.erl
+++ b/lib/wx/src/wx_object.erl
@@ -605,12 +605,15 @@ dbg_opts(Name, Opts) ->
%%-----------------------------------------------------------------
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, State, Mod, _Time]] = StatusData,
- NameTag = if is_pid(Name) ->
- pid_to_list(Name);
- is_atom(Name) ->
- Name
- end,
- Header = lists:concat(["Status for generic server ", NameTag]),
+ StatusHdr = "Status for wx object ",
+ Header = if
+ is_pid(Name) ->
+ lists:concat([StatusHdr, pid_to_list(Name)]);
+ is_atom(Name); is_list(Name) ->
+ lists:concat([StatusHdr, Name]);
+ true ->
+ {StatusHdr, Name}
+ end,
Log = sys:get_debug(log, Debug, []),
Specfic =
case erlang:function_exported(Mod, format_status, 2) of