~ubuntu-branches/ubuntu/saucy/rabbitmq-server/saucy

« back to all changes in this revision

Viewing changes to src/rabbit_misc.erl

  • Committer: Package Import Robot
  • Author(s): Emile Joubert
  • Date: 2013-06-25 11:28:52 UTC
  • mfrom: (0.5.4) (0.1.39 sid)
  • Revision ID: package-import@ubuntu.com-20130625112852-7po8xajec3kvogvv
Tags: 3.1.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
-export([multi_call/2]).
62
62
-export([os_cmd/1]).
63
63
-export([gb_sets_difference/2]).
64
 
-export([version/0]).
 
64
-export([version/0, which_applications/0]).
65
65
-export([sequence_error/1]).
66
66
-export([json_encode/1, json_decode/1, json_to_term/1, term_to_json/1]).
67
67
-export([check_expiry/1]).
232
232
-spec(os_cmd/1 :: (string()) -> string()).
233
233
-spec(gb_sets_difference/2 :: (gb_set(), gb_set()) -> gb_set()).
234
234
-spec(version/0 :: () -> string()).
 
235
-spec(which_applications/0 :: () -> [{atom(), string(), string()}]).
235
236
-spec(sequence_error/1 :: ([({'error', any()} | any())])
236
237
                       -> {'error', any()} | any()).
237
238
-spec(json_encode/1 :: (any()) -> {'ok', string()} | {'error', any()}).
985
986
    {ok, VSN} = application:get_key(rabbit, vsn),
986
987
    VSN.
987
988
 
 
989
%% application:which_applications(infinity) is dangerous, since it can
 
990
%% cause deadlocks on shutdown. So we have to use a timeout variant,
 
991
%% but w/o creating spurious timeout errors.
 
992
which_applications() ->
 
993
    try
 
994
        application:which_applications()
 
995
    catch
 
996
        exit:{timeout, _} -> []
 
997
    end.
 
998
 
988
999
sequence_error([T])                      -> T;
989
1000
sequence_error([{error, _} = Error | _]) -> Error;
990
1001
sequence_error([_ | Rest])               -> sequence_error(Rest).