summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2018-06-21 00:17:26 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2018-06-21 12:55:35 +0200
commit5f86d6158b4b7e2b8b03346617640c6336083bf0 (patch)
treec37089f24bfbed49f53df12abe73de3419cf1eb7
parent1ec9d1d7bdd01665deb3607ba6beb8bcd524b85d (diff)
downloadelixir-5f86d6158b4b7e2b8b03346617640c6336083bf0.tar.gz
Document long running processes pitfall in mix cmd, closes #7495
-rw-r--r--lib/elixir/lib/port.ex2
-rw-r--r--lib/mix/lib/mix/tasks/cmd.ex12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/elixir/lib/port.ex b/lib/elixir/lib/port.ex
index b035db5a9..06f33aa15 100644
--- a/lib/elixir/lib/port.ex
+++ b/lib/elixir/lib/port.ex
@@ -117,7 +117,7 @@ defmodule Port do
reimplementing core part of the Runtime System, such as the `:user` and
`:shell` processes.
- ## Zombie processes
+ ## Zombie OS processes
A port can be closed via the `close/1` function or by sending a `{pid, :close}`
message. However, if the VM crashes, a long-running program started by the port
diff --git a/lib/mix/lib/mix/tasks/cmd.ex b/lib/mix/lib/mix/tasks/cmd.ex
index f2bbe8b4a..636e80c4e 100644
--- a/lib/mix/lib/mix/tasks/cmd.ex
+++ b/lib/mix/lib/mix/tasks/cmd.ex
@@ -18,6 +18,18 @@ defmodule Mix.Tasks.Cmd do
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.
"""
def run(args) do