I am working on interactive tests https://github.com/assert-value/assert_value_elixir
The problem I am facing is in IO.puts/IO.gets in the case of async ExUnt tests.
To explain what I mean consider the following code:
Task.async(fn -> for _ <- 0..5 do :timer.sleep(100) IO.write "." end end) IO.gets("Waiting for input? ")
The output it produces is looking like this:
Waiting for input? .Waiting for input? .Waiting for input? .Waiting for input? .Waiting for input? .Waiting for input? .Waiting for input?
I want it to look like this:
.....Waiting for input?
or like this
Waiting for input? .....
Of course in that case I can use Task.await but in real case of async tests in ExUnit I don’t know what processes are currently run and what output they produce.
Is there any way to suppress IO output or stop IO processes while
any of the process is waiting for user input?