Skip to content

Commit e4ba8d5

Browse files
committed
Mix should not depend directly on Logger
1 parent 689f14a commit e4ba8d5

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/mix/lib/mix/tasks/app.start.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ defmodule Mix.Tasks.App.Start do
2828
# Stop the Logger after we have used it for compilation.
2929
# It is up to the application to decide if it should be
3030
# restarted or not.
31-
Logger.App.stop()
31+
# Mix should not depend directly on Logger so check that
32+
# it's loaded.
33+
if Code.ensure_loaded?(Logger), do: Logger.App.stop()
3234

3335
unless "--no-start" in args do
3436
start(Mix.Project.config[:app])

lib/mix/test/mix/task_test.exs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ defmodule Mix.TaskTest do
2323
end
2424

2525
test "try to compile if task is missing" do
26-
Mix.Project.push(SampleProject, "sample")
26+
in_fixture "no_mixfile", fn ->
27+
Mix.Project.push(SampleProject, "sample")
2728

28-
assert_raise Mix.NoTaskError, fn ->
29-
Mix.Task.run("unknown")
30-
end
29+
assert_raise Mix.NoTaskError, fn ->
30+
Mix.Task.run("unknown")
31+
end
3132

32-
# Check if compile task have run
33-
refute Mix.TasksServer.run({:task, "compile", Mix.Project.get})
33+
# Check if compile task have run
34+
refute Mix.TasksServer.run({:task, "compile", Mix.Project.get})
35+
end
3436
end
3537

3638
test "clear/0" do

0 commit comments

Comments
 (0)