Search code examples
hextravis-cielixirelixir-mix

Elixir mix auto acknowledge


I want to run tests of my Phoenix app on Travis-CI.

Log excerpt:

$ MIX_ENV=test mix do deps.get, compile, test

Could not find hex, which is needed to build dependency :phoenix

Shall I install hex? [Yn] 

When it comes to fetching and installing dependencies, it asks if it should install hex. I was wondering if I can pass a --yes option to mix so that it doesn't ask but just installs?


Solution

  • As with any unix command, you could pipe yes into the mix command:

    yes | MIX_ENV=test mix do deps.get, compile, test
    

    But there are some warnings about this solution in the comments below. I recommend using the top voted solution!