Skip to content

Commit af76eff

Browse files
committed
Use monitors instead of links in exunit
1 parent ebb867d commit af76eff

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/ex_unit/lib/ex_unit/runner.ex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ defmodule ExUnit.Runner do
8989
config.formatter.test_started(config.formatter_id, test)
9090

9191
# Run test in a new process so that we can trap exits for a single test
92-
Process.flag(:trap_exit, true)
9392
self_pid = self
94-
test_pid = spawn_link fn ->
93+
{ test_pid, test_ref } = Process.spawn_monitor fn ->
9594
test = try do
9695
context = test_case.__exunit__(:setup, Keyword.put(context, :test, test))
9796

@@ -122,7 +121,7 @@ defmodule ExUnit.Runner do
122121
receive do
123122
{ ^test_pid, :test_finished, test } ->
124123
pid <- { test_pid, :test_finished, test }
125-
{ :EXIT, ^test_pid, { error, stacktrace } } ->
124+
{ :DOWN, ^test_ref, :process, ^test_pid, { error, stacktrace } } ->
126125
test = test.failure { :EXIT, error, filter_stacktrace(stacktrace) }
127126
pid <- { test_pid, :test_finished, test }
128127
end

0 commit comments

Comments
 (0)