Replace explicit kill with linked process

Since the spawned process is linked and each koan is run inside its own
process, it gets killed by association.
This commit is contained in:
Jay Hayes
2016-05-04 15:32:37 -05:00
parent 4710ad1c63
commit 4bf62aa301

View File

@@ -59,15 +59,13 @@ defmodule Processes do
end end
koan "Use tail recursion to receive multiple messages" do koan "Use tail recursion to receive multiple messages" do
pid = spawn(&yelling_echo_loop/0) pid = spawn_link(&yelling_echo_loop/0)
send pid, {self, "o"} send pid, {self, "o"}
assert_receive ___ assert_receive ___
send pid, {self, "hai"} send pid, {self, "hai"}
assert_receive ___ assert_receive ___
Process.exit(pid, :kill)
end end
def state(value) do def state(value) do