It does not. Do it in iex and you will see what is happening.
iex(1)> {result, _} = Code.eval_string("IO.puts('a')")
a
{:ok, []}
iex(2)> IO.puts result
ok
:ok
The {:ok, []} from the first function call is the return value of calling Code.eval_string/3. In this case, you are binding the result variable to the atom :ok.
In the second line, you are printing out the atom :ok, which gets printed as ok. And then we see :ok as the return value of the IO.puts/2 call.
To my knowledge, you can’t. The default IO device for the IO.puts/2 function is :stdio. You would need the code written as Code.eval_string("IO.puts(:stderr, 'a')") in order to have it go to stderr.
Ah. You’re trying to let someone submit arbitrary Elixir code, and then describe the results. Can’t you just capture all output as was discussed in one of the other forum questions you asked? Why do you need to rewrite stderr and stdio?
BTW nothing will stop someone from writing Elixir code that undoes whatever it is you do to capture the IO. Eval allows anything.
What do you mean ? how exactly would I then be able to write as described in my post above ?
I just wanna treat each output differently, that’s why I’m choosing stderr and stdout