Mix.Shell

Hi all
Could someone please show me, how to use Mix.Shell behaviour.
For example, in the shell I can type whoami then it shows me, the logged user.
I want to catch the stdout but do not know how to use and implement Mix.Shell.

Thanks

3 Likes

If you want to invoke whoami then it is not related to Mix.Shell. You can use System.cmd/2 instead:

iex(1)> System.cmd "whoami", []
{"jose\n", 0}

Mix.Shell is for configuring how the Mix build tool interacts with the developer, it is not for running custom commands.

3 Likes