I would like to run a locally installed mix task, (by which I mean a task installed from another project using mix archive.build; mix archive.install) in the context of my app, but set a breakpoint first.
If I run iex -S mix locally.installed.task, that works fine. Of course the task has already run when I'm in my iex session.
That would be fine if I could subsequently run it again, after setting a breakpoint, like this:
break! Mix.Tasks.Locally.Installed.Task.run/1 #=> 1
Mix.Task.run("locally.installed.task", args) #=> :noop
however this just returns :noop for my locally installed task, though it works for tasks defined in the app or for default global tasks like mix deps.
Why does Mix.Task.run return :noop for a "locally installed" task?
Is there any way to use IEX to run a mix task while setting the breakpoint first?
edit: the :noop is mix making tasks idempotent. I.E., if I do iex -S mix deps, and then run Mix.Tasks.run("deps", []) I also get :noop, or if I run any given task in an iex -S mixsession withMix.Task.runit will only run once and subsequent invocations return:noop`
There is a Mix.Task.rerun/2 and that works...
As it said in docs, one should explicitly reenable the task with https://hexdocs.pm/mix/Mix.Task.html#reenable/1.
rerun/1would also work.