Issue of rendering newline/line-warp on the terminal after running iex -S mix in the specific project
Elixir and Erlang/OTP versions
Erlang/OTP 25 [erts-13.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]
Elixir 1.14.0 (compiled with Erlang/OTP 25)
Operating system
MacBook Pro 2019, macOS Monterey v12.6
Current behavior
The terminal rendering became weird every time I ran $ iex -S mix in one of my working projects, it displays newline from the position of the end of last line, meanwhile the input becomes invisible.
I don’t know how to fix that terminal session, all I can do is open a new one.
This issue only occurred in the specific project, not in any other projects, below are the steps of how do we reproduce the issue, and all my colleagues can reproduce this issue too.
Does anyone know if there’s anything I can do? Please help, thanks.
Reproducing in the macOS built-in Terminal v2.12.7 and Bash v3.2.57
- Execute
lsbefore$ iex -S mix, everything seems normal - Run
$ iex -S mixin the root directory of my project - Abort
iexwithctrl + \and the terminal rendering become weird - Execute
lsafter$ iex -S mix, the input command becomes invisible…

Reproducing in the iTerm2 v3.4.16 and Zsh v5.8

Expected behavior
The behavior of terminal rendering should be the same as before running iex -S mix.
Thank you for the report.
Unfortunately I cannot reproduce it. My suspicion is that your project or a dependency is mangling with the stdio file descriptors. Here are some options:
-
Change your
application.exto start no children:Supervisor.start_link([], strategy: :one_for_one). If the issue is fixed, add the children back one by one to figure the culprit. -
If the issue is not fixed, then it is most likely a dependency. Create a new project, copy the
depsfrom your mix.exs, and see if you can reproduce it. If not, copy the mix.lock from your project and see if it reproduces it.
The issue was fixed by removing the elixir-nodejs server from the children list in application.ex, now we have a starting point to figure out what to do next.
Thank you so much! @josevalim
Perfect, I will close this since I don't believe to be an Elixir issue. The project may be using fd0/fd1 for communication with Node, instead of redirecting to other descriptors. So maybe worth investigating.
Hi @josevalim,
don't mean to re-open this as I agree it's not an elixir issue, but I opened an issue on the nodejs lib about this and thought maybe you could have new ideas of how to address this given the few findings I made while debugging this ?
I am fairly new to elixir so I had some trouble debugging the node.js output when using iEX but still found some interesting things: https://github.com/revelrylabs/elixir-nodejs/issues/90
if you have an idea how we can make sure we sanitize correctly the escape characters sent by node, that might help us fix the problem