diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-02-26 14:11:29 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-02-26 14:11:29 +0000 |
commit | df5203289883c8044c44e2a5f181fef9f9fc496a (patch) | |
tree | f06c2122c929468c05ae876373bf15191010eb51 | |
parent | 6969eaeb23818c5e76906416ffa890cf1db54731 (diff) | |
download | rabbitmq-server-df5203289883c8044c44e2a5f181fef9f9fc496a.tar.gz |
Don't quote node atoms, it makes the resulting string harder to use in shell scripts.bug26039
-rw-r--r-- | src/rabbit_misc.erl | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 848c4a87..ab1c6063 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -685,7 +685,7 @@ pid_to_string(Pid) when is_pid(Pid) -> <<131,103,100,NodeLen:16,NodeBin:NodeLen/binary,Id:32,Ser:32,Cre:8>> = term_to_binary(Pid), Node = binary_to_term(<<131,100,NodeLen:16,NodeBin:NodeLen/binary>>), - format("<~w.~B.~B.~B>", [Node, Cre, Id, Ser]). + format("<~s.~B.~B.~B>", [Node, Cre, Id, Ser]). %% inverse of above string_to_pid(Str) -> @@ -695,13 +695,7 @@ string_to_pid(Str) -> case re:run(Str, "^<(.*)\\.(\\d+)\\.(\\d+)\\.(\\d+)>\$", [{capture,all_but_first,list}]) of {match, [NodeStr, CreStr, IdStr, SerStr]} -> - %% the NodeStr atom might be quoted, so we have to parse - %% it rather than doing a simple list_to_atom - NodeAtom = case erl_scan:string(NodeStr) of - {ok, [{atom, _, X}], _} -> X; - {error, _, _} -> throw(Err) - end, - <<131,NodeEnc/binary>> = term_to_binary(NodeAtom), + <<131,NodeEnc/binary>> = term_to_binary(list_to_atom(NodeStr)), [Cre, Id, Ser] = lists:map(fun list_to_integer/1, [CreStr, IdStr, SerStr]), binary_to_term(<<131,103,NodeEnc/binary,Id:32,Ser:32,Cre:8>>); |