Monitor watcher and wait for it to exit

This allows the parent process to exit when the watcher completes the
full koan run.
This commit is contained in:
Jay Hayes
2016-04-23 20:26:09 -05:00
parent 385ab0e236
commit 11f3560a2b

View File

@@ -5,7 +5,8 @@ defmodule Mix.Tasks.Meditate do
def run(args) do
Application.ensure_all_started(:elixir_koans)
Code.compiler_options(ignore_module_conflict: true)
Watcher.start
{:ok, watcher} = Watcher.start
Process.monitor(watcher)
Options.start(args)
@@ -15,7 +16,9 @@ defmodule Mix.Tasks.Meditate do
|> Tracker.start
|> Runner.run
:timer.sleep(:infinity)
receive do
{:DOWN, _references, :process, watcher, _reason} -> nil
end
end
defp ok?(koan) do