TIL about ELIXIR_CLI_DRY_RUN for elixir and iex
⭐️ a blog post
While I’ve been working on deploying some elixir releases I’ve been trying to understand how the flags I’m setting end up being seen by erlang. Well, it turns out elixir has an ENV var for this named ELIXIR_CLI_DRY_RUN
.
Here is an example:
$ ELIXIR_CLI_DRY_RUN=1 iex
erl -pa /usr/local/Cellar/elixir/1.11.2/bin/../lib/eex/ebin \
/usr/local/Cellar/elixir/1.11.2/bin/../lib/elixir/ebin \
/usr/local/Cellar/elixir/1.11.2/bin/../lib/ex_unit/ebin \
/usr/local/Cellar/elixir/1.11.2/bin/../lib/iex/ebin \
/usr/local/Cellar/elixir/1.11.2/bin/../lib/logger/ebin \
/usr/local/Cellar/elixir/1.11.2/bin/../lib/mix/ebin \
-noshell \
-user Elixir.IEx.CLI \
-extra --no-halt +iex
You can see a lot of interesting info here:
elixir
oriex
are always just runningerl
in the end-pa
is to prepend a module load path and elixir makes sure all it’s modules are accessible at boot-noshell
means to, uh, not start the erlang shell, since iex is going to boot up it’s own shell in it’sstart
function with:user_drv
(find it in the erl docs)-user
is the first module erlang will callstart
of after boot, in this instance it’sElixir.IEx.CLI
-extra
means “erl
won’t look at these, but they are available with:init.get_plain_arguments()
which elixir does a few times--no-halt
tells elixir not to auto-exit after boot, so iex can setup it’s shell and accept input+iex
is a special flag elixir looks for while starting up it’s CLI (which is also called byIEx.start
)
I found this super interesting and it helped me learn a lot about how erlang boots up, how modules are loaded, etc.