Mix v1.1.0 Mix.Tasks.Run

Runs the given file or expression in the context of the application.

You can use this task to execute a particular file or command:

mix run -e Hello.world
mix run my_script.exs

This task provides a subset of the functionality available in the elixir executable, including setting up the System.argv:

mix run my_script.exs arg1 arg2 arg3

You can also use this task to simply start an application and keep it running without halting:

mix run --no-halt

Before running any command, the task compiles and starts the current application. Those can be configured with the options below.

You may also pass option specific to the elixir executable as follows:

elixir --sname hello -S mix run --no-halt

Command line options

  • --config, -c - loads the given configuration file
  • --eval, -e - evaluate the given code
  • --require, -r - require pattern before running the command
  • --parallel-require, -pr - requires pattern in parallel
  • --no-compile - do not compile even if files require compilation
  • --no-deps-check - do not check dependencies
  • --no-halt - do not halt the system after running the command
  • --no-start - do not start applications after compilation

Summary

Functions

Callback implementation for Mix.Task.run/1

Functions

run(args)

Specs

run(OptionParser.argv) :: :ok

Callback implementation for Mix.Task.run/1.