Exit from the iex shell

1,268 views
Skip to first unread message

John Kemp

unread,
May 7, 2013, 2:16:17 PM5/7/13
to elixir-l...@googlegroups.com
When I use erl, I can exit using the q(). command. With iex, there seems no equivalent.

Is there a reason not to have an IEX helper for q()? Especially since if I do ^G (as in erl) and then q, this works...

slepneir:elixir-0.8.2 kempj$ bin/iex
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]

Interactive Elixir (0.8.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> ^G
User switch command
--> q

I know there are worries about remote shells (as written here: https://github.com/elixir-lang/elixir/pull/786) but the advice could be something like what is written in LYSE: http://learnyousomeerlang.com/starting-out

Seems odd to this Erlang programmer that iex mostly looks like erl, but doesn't support the same quit function. Ctrl-C always feels dangerous to me :)

Cheers,

JohnK

José Valim

unread,
May 7, 2013, 5:37:51 PM5/7/13
to elixir-l...@googlegroups.com
Maybe we could have a q() that checks if we are on a remote shell and exit properly. I need to experiment with it. :)


José Valim
Skype: jv.ptec
Founder and Lead Developer



--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



John kemp

unread,
May 7, 2013, 8:25:22 PM5/7/13
to elixir-l...@googlegroups.com, elixir-l...@googlegroups.com
Even before that, it would perhaps make sense to advertise on startup of iex that you can use CTRL-G to exit, as with erl, instead of CTRL-C? That would be a very simple change (even I could make that change ;)

JohnK

José Valim

unread,
May 7, 2013, 8:54:44 PM5/7/13
to elixir-l...@googlegroups.com
The problem with Ctrl+G is that it doesn't say anything after you press it, so people need to know it needs to be followed by a q or a h.

Ctrl+C at least shows a menu. :)

Jeremy Huffman

unread,
May 7, 2013, 8:56:33 PM5/7/13
to elixir-l...@googlegroups.com
Yes Ctrl-G was mystifying to me at first. Also I think Erlang and Elixir might be the only REPLs that will not quit immediately from a CTRL-D.

John Kemp

unread,
May 8, 2013, 9:02:33 AM5/8/13
to elixir-l...@googlegroups.com
On May 7, 2013, at 8:56 PM, Jeremy Huffman wrote:

> Yes Ctrl-G was mystifying to me at first.

CTRL-G would simply need to be advertised as it is in erl though instead of CTRL-C. But it would only make any sense to an Erlang programmer, which may not be good enough.

> Also I think Erlang and Elixir might be the only REPLs that will not quit immediately from a CTRL-D.

This is true. CTRL-D would make more sense to me. Historically, that is the Unix shell command for 'end text input', and works in more than just some REPLs...

I suppose that's the problem I have with CTRL-C, whose historical (Unix) semantics are "interrupt running program" (see http://web.cecs.pdx.edu/~rootd/catdoc/guide/TheGuide_38.html)

But why shouldn't q(). (or 'q') work too? That is also in some form also supported by many REPLs...

JohnK

John Kemp

unread,
May 8, 2013, 9:12:37 AM5/8/13
to elixir-l...@googlegroups.com
By the way, it is also worth noting that neither erl, nor iex is really (only) officially a REPL, FWIW, since you can do lots of other things at the console, including getting a remote shell onto a running program :)

JohnK
Reply all
Reply to author
Forward
0 new messages