In general, you can also press Ctrl-G, which will take you to the "User switch command" mode with the prompt ---> . From here, you can enter i to end the IEx session, then c to reconnect to it; IEx will then indicate ** (EXIT) interrupted and return to the state it was in before you got stuck. This is a feature of the Erlang (erl) shell that was inherited by IEx.
An example of this in action:
iex(3)> Enum.each '12345', &(IO.puts(&1")) ...(3)> end ...(3)> ) ...(3)> ' ...(3)> end ...(3)> "" ...(3)> <-- Ctrl-G goes here (not shown normally) User switch command --> i --> c ** (EXIT) interrupted iex(3)>
YellowApple Jan 23 '15 at 19:25 2015-01-23 19:25
source share