Skip to content

Commit 95b81c2

Browse files
josevalimJosé Valim
authored andcommitted
Merge pull request #3025 from MSch/flush-logger-after-tests
Call Logger.flush in System.at_exit when running mix test. Signed-off-by: José Valim <[email protected]>
1 parent a525f71 commit 95b81c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/mix/lib/mix/tasks/test.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ defmodule Mix.Tasks.Test do
190190
if cover, do: cover.()
191191

192192
System.at_exit fn _ ->
193+
# Make sure all messages the tests might have sent to the
194+
# Logger are printed before we shut down the VM.
195+
case Process.whereis(Logger) do
196+
pid when is_pid(pid) -> Logger.flush()
197+
nil -> :ok
198+
end
199+
193200
if failures > 0, do: exit({:shutdown, 1})
194201
end
195202
end

0 commit comments

Comments
 (0)