Blob Blame Raw
From: Peter Lemenkov <>
Date: Fri, 15 Jul 2016 16:01:08 +0200
Subject: [PATCH] Use proto_dist from command line

Use protocol distribution value from command line when provided instead
of always using default value (inet_tcp) when trying to check epmd.

If provided more than one protocol distribution types, then use the
first one.

Signed-off-by: Peter Lemenkov <>

diff --git a/src/rabbit_nodes_common.erl b/src/rabbit_nodes_common.erl
index f06c3d0..63c35ec 100644
--- a/src/rabbit_nodes_common.erl
+++ b/src/rabbit_nodes_common.erl
@@ -80,10 +80,15 @@ do_ensure_epmd(false, Prog) ->
     rabbit_log:error("ensure_epmd: unable to find executable '~s' in PATH: '~s'", [Prog, Path]);
 do_ensure_epmd(Exe, _) ->
     ID = rabbit_misc:random(1000000000),
+    ProtoDist = case init:get_argument(proto_dist) of
+            {ok, [Proto | _Protos]} -> Proto;
+            error -> "inet_tcp"
+    end,
     Port = open_port(
              {spawn_executable, Exe},
              [{args, ["-boot", "no_dot_erlang",
                       "-sname", rabbit_misc:format("epmd-starter-~b", [ID]),
+                      "-proto_dist", rabbit_misc:format("~p", [ProtoDist]),
                       "-noinput", "-s", "erlang", "halt"]},
               exit_status, stderr_to_stdout, use_stdio]),