Mix v1.7.2 mix cmd View Source
Executes the given command.
Useful in umbrella applications to execute a command on each child app:
mix cmd echo pwd
You can limit which apps the cmd runs in by passing the app names before the cmd using —app:
mix cmd --app app1 --app app2 echo pwd
Aborts when a command exits with a non-zero status.
Zombie OS processes
Beware that the Erlang VM does not terminate child processes
when it shuts down. Therefore, if you use mix cmd
to start
long running processes and then shutdown the VM, it is likely
that those child processes won’t be terminated with the VM.
A solution is to make sure the child processes listen to the
stdndard input and terminate when standard input is closed.
We discuss this topic at length in the “Zombie OS processes”
of the Port
module documentation.
Link to this section Summary
Link to this section Functions
A task needs to implement run
which receives
a list of command line args.
Callback implementation for Mix.Task.run/1
.