# Change mix run command to task for Debugging

**URL:** <https://forum.elixirforum.com/t/change-mix-run-command-to-task-for-debugging/15780>\
**Category:** Questions\
**Tags:** debugging, vs-code\
**Created:** [August 12, 2018, 12:25pm UTC](https://forum.elixirforum.com/t/change-mix-run-command-to-task-for-debugging/15780 "2018-08-12T12:25:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phildorado](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/p/48db29/32.png) [@phildorado](https://forum.elixirforum.com/u/phildorado)\
**Post date:** [August 12, 2018, 12:25pm UTC](https://forum.elixirforum.com/t/change-mix-run-command-to-task-for-debugging/15780/1 "2018-08-12T12:25:23Z")

</div>

Elixir noob here and apologies in advance if this has already been answered/is really stupid.

Trying to debug open source project strobe audio. [https://github.com/strobe-audio:](https://github.com/strobe-audio:)  
mix run -e “Peel.scan()” from the command line works.  
I’m trying to move this into a mix task so I can use the debugger in VS Code. I can call this function from the task, but it appears the application is not running as I get an error “Peel.Repo is not started, please ensure it is part of your supervision tree”. How can I build the application the same way that mix run does, but from a task? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![easco](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/easco/32/1250_2.png) [@easco](https://forum.elixirforum.com/u/easco)\
**Post date:** [August 13, 2018, 1:50pm UTC](https://forum.elixirforum.com/t/change-mix-run-command-to-task-for-debugging/15780/2 "2018-08-13T13:50:35Z")

</div>

Look in the documentation here:

> **[Mix — Mix v1.20.2](https://mix.hexdocs.pm/Mix.html)**

In the section about Aliases. You should be able to create an alias for your mix run command, I believe.

---

<div class="post-metadata">

**Author:** ![JakeBecker](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jakebecker/32/11288_2.png) [@JakeBecker](https://forum.elixirforum.com/u/JakeBecker)\
**Post date:** [August 13, 2018, 10:55pm UTC](https://forum.elixirforum.com/t/change-mix-run-command-to-task-for-debugging/15780/3 "2018-08-13T22:55:45Z")

</div>

`run` is already a Mix task. Try setting your debug config to something like this:

```elixir
{
  "type": "mix_task",
  "name": "Peel.scan/0",
  "request": "launch",
  "task": "run",
  "taskArgs": ["-e", "Peel.scan()"],
  "projectDir": "${workspaceRoot}"
}

```

---

<div class="post-metadata">

**Author:** ![phildorado](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/p/48db29/32.png) [@phildorado](https://forum.elixirforum.com/u/phildorado)\
**Post date:** [August 15, 2018, 10:24am UTC](https://forum.elixirforum.com/t/change-mix-run-command-to-task-for-debugging/15780/4 "2018-08-15T10:24:46Z")

</div>

Thanks so much. This is working, however there is something else in ecto.migrate that is causing an exception in the debugger, but not from the terminal. But at least I can start the debugger now.
