diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-09 11:22:56 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-09 11:22:56 +0100 |
| commit | 0447b0d9fa031ecff354dfb280ad74d4ce70e99e (patch) | |
| tree | d39efa5e5b3f80f180554bf297962896be2fc03f /src | |
| parent | 0a515e34c291ab00ae39330ed2c5f5b659ee9797 (diff) | |
| download | rabbitmq-server-git-0447b0d9fa031ecff354dfb280ad74d4ce70e99e.tar.gz | |
refactor
Move quit/0 into rabbit_misc and remove ezs from provided_plugins/ during
clean.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_control.erl | 19 | ||||
| -rw-r--r-- | src/rabbit_misc.erl | 9 | ||||
| -rw-r--r-- | src/rabbit_plugin.erl | 9 |
3 files changed, 16 insertions, 21 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 1163ae9d86..b28748538e 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -86,24 +86,24 @@ start() -> true -> ok; false -> io:format("...done.~n") end, - quit(0); + rabbit_misc:quit(0); {'EXIT', {function_clause, [{?MODULE, action, _} | _]}} -> print_error("invalid command '~s'", [string:join([atom_to_list(Command) | Args], " ")]), usage(); {error, Reason} -> print_error("~p", [Reason]), - quit(2); + rabbit_misc:quit(2); {badrpc, {'EXIT', Reason}} -> print_error("~p", [Reason]), - quit(2); + rabbit_misc:quit(2); {badrpc, Reason} -> print_error("unable to connect to node ~w: ~w", [Node, Reason]), print_badrpc_diagnostics(Node), - quit(2); + rabbit_misc:quit(2); Other -> print_error("~p", [Other]), - quit(2) + rabbit_misc:quit(2) end. fmt_stderr(Format, Args) -> rabbit_misc:format_stderr(Format ++ "~n", Args). @@ -154,7 +154,7 @@ stop() -> usage() -> io:format("~s", [rabbit_ctl_usage:usage()]), - quit(1). + rabbit_misc:quit(1). %%---------------------------------------------------------------------------- @@ -506,10 +506,3 @@ prettify_typed_amqp_value(table, Value) -> prettify_amqp_table(Value); prettify_typed_amqp_value(array, Value) -> [prettify_typed_amqp_value(T, V) || {T, V} <- Value]; prettify_typed_amqp_value(_Type, Value) -> Value. - -%% the slower shutdown on windows required to flush stdout -quit(Status) -> - case os:type() of - {unix, _} -> halt(Status); - {win32, _} -> init:stop(Status) - end. diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index ae28722ab2..0b72443fa5 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -59,6 +59,7 @@ -export([pget/2, pget/3, pget_or_die/2]). -export([format_message_queue/2]). -export([append_rpc_all_nodes/4]). +-export([quit/1]). %%---------------------------------------------------------------------------- @@ -210,6 +211,7 @@ -spec(pget_or_die/2 :: (term(), [term()]) -> term() | no_return()). -spec(format_message_queue/2 :: (any(), priority_queue:q()) -> term()). -spec(append_rpc_all_nodes/4 :: ([node()], atom(), atom(), [any()]) -> [any()]). +-spec(quit/1 :: (integer() | string()) -> no_return()). -endif. @@ -963,3 +965,10 @@ append_rpc_all_nodes(Nodes, M, F, A) -> {badrpc, _} -> []; _ -> Res end || Res <- ResL]). + +%% the slower shutdown on windows required to flush stdout +quit(Status) -> + case os:type() of + {unix, _} -> halt(Status); + {win32, _} -> init:stop(Status) + end. diff --git a/src/rabbit_plugin.erl b/src/rabbit_plugin.erl index 4987dc5952..6d94cee73a 100644 --- a/src/rabbit_plugin.erl +++ b/src/rabbit_plugin.erl @@ -33,16 +33,9 @@ start() -> io:format("Rabbitmq-plugin, GO!~n"), - quit(0). + rabbit_misc:quit(0). stop() -> ok. %%---------------------------------------------------------------------------- - -%% the slower shutdown on windows required to flush stdout -quit(Status) -> - case os:type() of - {unix, _} -> halt(Status); - {win32, _} -> init:stop(Status) - end. |
