Skip to content

Commit a794c6e

Browse files
author
José Valim
committed
Ensure run --no-start still triggers loadpaths, closes #6303
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent 17ae84e commit a794c6e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/mix/lib/mix/tasks/run.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ defmodule Mix.Tasks.Run do
8383

8484
# Start app after rewriting System.argv,
8585
# but before requiring and evaling.
86-
if opts[:start] != false do
87-
Mix.Task.run "app.start", args
88-
end
86+
Mix.Task.run "app.start", args
8987

9088
process_load(opts, expr_evaluator)
9189

lib/mix/test/mix/tasks/run_test.exs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ defmodule Mix.Tasks.RunTest do
3737
purge [GitRepo]
3838
end
3939

40+
test "does not start applications on --no-start", context do
41+
in_tmp context.test, fn ->
42+
Mix.Tasks.Run.run ["--no-start", "-e", "send self(), {:apps, Application.started_applications}"]
43+
assert_received {:apps, apps}
44+
refute List.keyfind(apps, :sample, 0)
45+
Mix.Task.clear
46+
47+
Mix.Tasks.Run.run ["-e", "send self(), {:apps, Application.started_applications}"]
48+
assert_received {:apps, apps}
49+
assert List.keyfind(apps, :sample, 0)
50+
end
51+
end
52+
4053
test "run errors on missing files", context do
4154
in_tmp context.test, fn ->
4255
assert_raise Mix.Error, "No files matched pattern \"non-existent\" given to --require", fn ->

0 commit comments

Comments
 (0)