gmile
Spawning a new VM node dynamically
Hi all,
I’m trying to test communication between two Erlang VM nodes. There’s a way to do so in Erlang by using CT Slave http://erlang.org/doc/man/ct_slave.html.
I’ve tested it and so far it looks like I can spawn new nodes pretty easily using ct_slave.start. However, all such nodes are “blank”, e.g. no app’s code is loaded in them. And I can’t seem to figure out how to spawn a node with my app’s own code.
I began the investigation.
From looking at the running processes using ps, here’s what I see:
Programmatically ran node:
61133 ?? S 0:00.16 /usr/local/Cellar/erlang/19.1/lib/erlang/erts-8.1/bin/beam.smp -- -root /usr/local/Cellar/erlang/19.1/lib/erlang -progname erl -- -home /Users/gmile -- -noshell -noinput -noshell -noinput -setcookie WYNSTOZWBNWPAJPYXXZW -sname yo@localhost
Node, ran normally via iex -S mix run:
58597 ?? S 0:04.24 /usr/local/Cellar/erlang/19.1/lib/erlang/erts-8.1/bin/beam.smp -- -root /usr/local/Cellar/erlang/19.1/lib/erlang -progname erl -- -home /Users/gmile -- -pa /usr/local/Cellar/elixir/1.3.4/bin/../lib/eex/ebin /usr/local/Cellar/elixir/1.3.4/bin/../lib/elixir/ebin /usr/local/Cellar/elixir/1.3.4/bin/../lib/ex_unit/ebin /usr/local/Cellar/elixir/1.3.4/bin/../lib/iex/ebin /usr/local/Cellar/elixir/1.3.4/bin/../lib/logger/ebin /usr/local/Cellar/elixir/1.3.4/bin/../lib/mix/ebin -noshell -s elixir start_cli -sname testnode1@localhost -setcookie test_cookie -extra --sname testnode1@localhost --cookie test_cookie --no-halt -S mix run
From looking at the second, “normal” output, it looks like mix generates all the ebin paths and appends them as arguments to beam.smp.
Thus my question is – how can I have Mix give me a list of all these ebin paths, so that I could provide them manually to :ct_slave.start, e.g. when spawning a new node programmatically?








