Open vasu-dasari opened 6 years ago
Just found that I had to give full path name of where vm.args file is located, that fixed the problem of locating the vm.args file. But, for consistency it will be a good idea to fix this. Now, I see this error:
===> sh(elixir -e "IO.puts :code.lib_dir(:elixir)")
failed with return code 1 and the following output:
Protocol 'inet_tcp': the name demo@b40fb051a6c7 seems to be in use by another Erlang node
This is a fresh docker instance, and no other instances of demo are running. So, this error message looks suspicious. Can you help me fix this error?
Ok. I see the reason why it is failing. Will have a PR shortly. Now I start application with:
ERL_FLAGS=" -args_file ${PWD}config/vm.args" rebar3 shell
and my vm.args file contains, -snmae demo
.
rebar3 shell
tries to issue compile
directive to provider(plugins) to see if the source code has to be re-compiled. rebar3 would have set ERL_FLAGS to "ERL_FLAGS= -args_file .../demo/config/vm.args" already before calling this. And also, it would have started the VM already with vm.args. Lets call this parent VM, and will have sname
as specified in vm.args
.
In rebar3_elixir_compile_util, a dependency elixir file is compiled with following command: /usr/local/bin/mix deps.get
.
Now, this would spawn another VM with previously set ERL_FLAGS. And this new VM could not be spawned because the node name is already in use(becuase of parent VM created by rebar3 shell
).
So, the fix would be to create wrapper for rebar_utils:sh() in rebar3_elixir_compile_util as:
sh(Command, Options) ->
rebar_utils:sh(Command, [{env, [{"ERL_FLAGS", ""}]} | Options]).
I will shortly create pull request for this.
him interesting I wonder if except the node name resolution something else can be problematic. Imo we should be able to pass includes -I
and path -pa
args at least so everything would be included. Thoughts?
I have been playing with the example "demo" code from the repo. I wanted to add a sname to the demo Erlang VM. So, created a file called,
config/vm.args
in the demo directory which looks like:And issued the following commands from the demo directory:
And in docker from demo directory:
I see the following error:
On turning DEBUG=1, I see the following message:
I generally use this command
ERL_FLAGS=" -args_file config/vm.args" rebar3 shell
to run rebar3 shell for normal Erlang-Rebar projects. I expected to see this working for Elixir imported projects as well. May I know what do I need to do to make this command work.