def prompt(message) do
print_app()
send(process(), {:mix_shell, :prompt, [message]})
receive do
{:mix_shell_input, :prompt, response} -> response
after
0 -> raise "no shell process input given for prompt/1"
end
end
Not sure how internal this is, but seems like something that you can use to mock user input.
Sorry for the confusion. I did misread the question. Seems Mix.Shell.Process is exactly what you need:
This is mainly useful in tests, allowing us to assert if given messages were received or not instead of performing checks on some captured IO. Since we need to guarantee a clean slate between tests, there is also a flush/1 function responsible for flushing all :mix_shell related messages from the process inbox.