Another way to exiting IEX other than ctrl-C

后端 未结 5 997
醉话见心
醉话见心 2021-02-01 14:34

I know we can exit the IEX console with control-C. I\'m curious if there\'s a command to type into the console that would also do the same thing.

5条回答
  •  梦毁少年i
    2021-02-01 15:11

    1. Disconnect from shell and stop current node. This is what you need in most cases.

      1.1. Ctrl+\ - standard method to quit the Erlang shell. See "4.4 How do I quit the Erlang shell?" in Erlang -- Getting Started.

      1.2. Ctrl+C, a, Enter - via the (a)bort command of the Break menu.

      1.3. Ctrl+C, Ctrl+C - looks like undocumented feature of the Break menu.

      1.4. Ctrl+G, q, Enter - via the q (quit erlang) commant of the User Switch menu (see Erlang -- shell -- JCL Mode).

      Note: this leaves remote node alive if you have connected to it with iex --remsh (see iex --help and IEx -- Remote Shells).

    2. Shut down the node you are connected to.

      2.1. System.halt - quick and dirty shut down. The runtime system exits with status code 0 (clean exit without errors). You can also call System.halt(:abort) to abort with core dump. Same as :erlang.halt.

      2.2. :init.stop (System.stop in future versions) - clean shutdown. All applications are taken down smoothly, all code is unloaded, and all ports are closed before the system terminates by calling halt(Status).

      Note: this leaves your shell alive if you have connected to a remote shell with iex --remsh.

    Notice that all these options are disabled if Erlang is started with the ignore break, +Bi, system flag: iex --erl +Bi (which can be useful, for example when running a restricted shell). See Erlang -- erl for more info.

提交回复
热议问题