diff options
-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}}) |