diff options
author | Tim Watson <tim@rabbitmq.com> | 2012-06-06 15:51:21 +0100 |
---|---|---|
committer | Tim Watson <tim@rabbitmq.com> | 2012-06-06 15:51:21 +0100 |
commit | 2471f4530305e0948e8a3113dfed6472131b05bf (patch) | |
tree | 6d402cf5e83c1dcd73fb831682e26c3bf807f2e1 | |
parent | 73558487fcfb27f05d0c41f556dd7ceb659030c1 (diff) | |
download | rabbitmq-server-bug24982.tar.gz |
simply reading pid files in a way that works on R12Bbug24982
-rw-r--r-- | src/rabbit_control_main.erl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl index a36fe90c..2e163cfb 100644 --- a/src/rabbit_control_main.erl +++ b/src/rabbit_control_main.erl @@ -491,10 +491,8 @@ read_pid_file(PidFile, Wait) -> case {file:read_file(PidFile), Wait} of {{ok, Bin}, _} -> S = binary_to_list(Bin), - PidS = case string:words(S) > 1 of - true -> string:sub_word(S, 1); - false -> string:strip(S, right, $\n) - end, + {match, [PidS]} = re:run(S, "[^\\s]+", + [{capture, all, list}]), try list_to_integer(PidS) catch error:badarg -> exit({error, {garbage_in_pid_file, PidFile}}) |