In my startup script, I am starting erlang with:
erl -args_file vm.args
Currently, while trying to run unit tests with rebar eunit
is there a way for me to pass custom runtime arguments such as the -args_file option to the erlang process that rebar kicks off? I have searched docs high and low to no avail...
I appreciate the help.
I answered my own question. I use the ERL_FLAGS variable to pass command line args. Here is a snippet from my Makefile:
ERL_FLAGS="-args_file test/conf/vm.eunit.args" ./rebar skip_deps=true eunit
The first method is satisfied with your restriction:
1. in your eunit test function, to use erlang's "os:cmd("erl -name bar -detached arguments")."
to start another erlang node. In the arguments, you can insert whatever you want. But eunit's check will be difficult because the test will cross the nodes.
The second methods is to change your restriction: 1. To use "configuremnt file" to pass arguments, and not to use command parameter to pass parameters.
来源:https://stackoverflow.com/questions/10307575/passing-runtime-arguments-to-erlang-when-running-rebar-eunit