Skip to content

Processes spawned by mix cmd aren't terminated on abort #7495

@digitalcora

Description

@digitalcora

Environment

  • Erlang 20.3.2 + Elixir 1.6.4
  • Observed on Mac OS 10.13.3 and Alpine Linux 3.7

Current behavior

When using mix cmd --app <name> mix run --no-halt within an umbrella project, the mix run command seems to keep running in the background indefinitely, even after the mix cmd command has been terminated by Ctrl-C.

The best example I have at hand is Phoenix, since its generator produces an umbrella project complete with apps, and phx.server uses the --no-halt option. Minimal demo:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
$ mix phx.new hello --umbrella
$ cd hello_umbrella

$ mix cmd --app hello_web mix phx.server
==> hello_web
[info] Running HelloWeb.Endpoint with Cowboy using http://0.0.0.0:4000
^C
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
^C

$ ps -x | grep phx.server
11416 ??         0:01.82 /usr/local/Cellar/erlang/20.3.2/lib/erlang/erts-9.3/bin/beam.smp -- -root /usr/local/Cellar/erlang/20.3.2/lib/erlang -progname erl -- -home /Users/alex -- -pa /usr/local/Cellar/elixir/1.6.4/bin/../lib/eex/ebin /usr/local/Cellar/elixir/1.6.4/bin/../lib/elixir/ebin /usr/local/Cellar/elixir/1.6.4/bin/../lib/ex_unit/ebin /usr/local/Cellar/elixir/1.6.4/bin/../lib/iex/ebin /usr/local/Cellar/elixir/1.6.4/bin/../lib/logger/ebin /usr/local/Cellar/elixir/1.6.4/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra /usr/local/bin/mix phx.server

Expected behavior

Naïvely I'd expect aborting a mix cmd command to abort any sub-command it spawned, and not leave it running in the background.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions