Skip to content

Commit 80a466a

Browse files
author
José Valim
committed
Merge pull request #1871 from tonini/mix-iex-task
Add mix iex that simply fails and tell users to use iex -S mix
2 parents 83db533 + 4544ab5 commit 80a466a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

lib/mix/lib/mix/tasks/iex.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
defmodule Mix.Tasks.Iex do
2+
use Mix.Task
3+
4+
@hidden true
5+
6+
def run(_) do
7+
raise Mix.Error, message: "Cannot start IEx after the VM was booted, " <>
8+
"to use IEx with Mix, please run: iex -S mix"
9+
end
10+
end

lib/mix/test/mix/tasks/iex_test.exs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Code.require_file "../../test_helper.exs", __DIR__
2+
3+
defmodule Mix.Tasks.IexTest do
4+
use MixTest.Case
5+
6+
test "iex raises error message about correct usage" do
7+
in_fixture "only_mixfile", fn ->
8+
error_message = "Cannot start IEx after the VM was booted, " <>
9+
"to use IEx with Mix, please run: iex -S mix"
10+
assert_raise Mix.Error, error_message, fn ->
11+
Mix.Tasks.Iex.run []
12+
end
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)