diff options
author | Steve Vinoski <[email protected]> | 2009-11-28 21:11:35 -0500 |
---|---|---|
committer | Steve Vinoski <[email protected]> | 2009-11-29 11:06:13 -0500 |
commit | 2a9b7a1c7816812dd637933a8fbf61bed6742785 (patch) | |
tree | e18e228fb9f75dc8a96993086e5ec2ac3e8bff87 /lib/stdlib/src | |
parent | 84adefa331c4159d432d22840663c38f155cd4c1 (diff) | |
download | otp-2a9b7a1c7816812dd637933a8fbf61bed6742785.tar.gz otp-2a9b7a1c7816812dd637933a8fbf61bed6742785.tar.bz2 otp-2a9b7a1c7816812dd637933a8fbf61bed6742785.zip |
gen_fsm: Fix format_status/2 to handle Pids
gen_fsm:format_status/2 currently crashes if Name in the process
state is a Pid.
Handle Name in the same way as in gen_server:format_status/2
to eliminate the crash.
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/gen_fsm.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl index f3775f967a..ba0275ae2b 100644 --- a/lib/stdlib/src/gen_fsm.erl +++ b/lib/stdlib/src/gen_fsm.erl @@ -603,7 +603,12 @@ get_msg(Msg) -> Msg. format_status(Opt, StatusData) -> [PDict, SysState, Parent, Debug, [Name, StateName, StateData, Mod, _Time]] = StatusData, - Header = lists:concat(["Status for state machine ", Name]), + NameTag = if is_pid(Name) -> + pid_to_list(Name); + is_atom(Name) -> + Name + end, + Header = lists:concat(["Status for state machine ", NameTag]), Log = sys:get_debug(log, Debug, []), Specfic = case erlang:function_exported(Mod, format_status, 2) of |