Sunday, October 30, 2022

[FIXED] How to quit after run IO.read(:stdio, :all) in the Elixir iex?

Issue

I need test some input data flow, and use 'IO.read', but after entering data i can't exit from this mode, CTRL-Z/X/C/D doesn't help (it terminates the whole iex). So how correct EOF command for this mode? Thanks!


Solution

TL;DR: Use ^G followed by j, i [nn] and c [nn].


In both erl and iex shells you always might ^G to enter a “User switch command” mode. Type h for help there.

iex|1 ▶ IO.read :stdio, :all

^G
User switch command
  --> j
    1* {erlang,apply,[#Fun<Elixir.IEx.CLI.1.96155272>,[]]}
  --> i 1
  --> c 1
{:error, :interrupted}

iex|2 ▶

Sidenote: the correct EOF termination would be ^D in all the terminals. I honestly have no idea why it does not work as expected in erl/iex consoles.



Answered By - Aleksei Matiushkin
Answer Checked By - Willingham (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.