diff options
author | Geoff Cant <[email protected]> | 2010-06-12 16:49:54 -0700 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2010-07-07 16:34:09 +0200 |
commit | 95ed86fc9893460751c5141ff872bdc13814a273 (patch) | |
tree | 1722de5f58c95432ca4de75e590c9c90aa4a8334 /lib/stdlib/src/gen.erl | |
parent | c752a4ea65c744ac283cc277717f8defa15ae610 (diff) | |
download | otp-95ed86fc9893460751c5141ff872bdc13814a273.tar.gz otp-95ed86fc9893460751c5141ff872bdc13814a273.tar.bz2 otp-95ed86fc9893460751c5141ff872bdc13814a273.zip |
Fix format_status bug for unregistered gen_event processes
Port the gen_fsm code for format_status to gen_event in order to
prevent a lists:concat([...,pid()]) crash when calling
sys:get_status/1 on an unregistered gen_event process.
Refactor format_status header code from gen_* behaviours to module gen.
Extend the format_status tests in gen_event_SUITE to cover
format_status bugs with anonymous gen_event processes.
Diffstat (limited to 'lib/stdlib/src/gen.erl')
-rw-r--r-- | lib/stdlib/src/gen.erl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/stdlib/src/gen.erl b/lib/stdlib/src/gen.erl index 43df6f621d..574146b1cd 100644 --- a/lib/stdlib/src/gen.erl +++ b/lib/stdlib/src/gen.erl @@ -29,6 +29,8 @@ -export([init_it/6, init_it/7]). +-export([format_status_header/2]). + -define(default_timeout, 5000). %%----------------------------------------------------------------- @@ -315,3 +317,10 @@ debug_options(Opts) -> {ok, Options} -> sys:debug_options(Options); _ -> [] end. + +format_status_header(TagLine, Pid) when is_pid(Pid) -> + lists:concat([TagLine, " ", pid_to_list(Pid)]); +format_status_header(TagLine, RegName) when is_atom(RegName) -> + lists:concat([TagLine, " ", RegName]); +format_status_header(TagLine, Name) -> + {TagLine, Name}. |