Jack Liu
Jack Liu

Reputation: 57

How to ban ban ctrl+c in erlang

I use run_erl to start an erlang application, just like this

run_erl -daemon /tmp/erl_pipe /tmp/erl_log "erl -name [email protected] -setcookie 123456"

Then I Attach to erlang shell like this

to_erl /tmp/erl_pipe

And the question is, I used to quit erlang shell with 'ctrl + c', in this situation, 'ctrl+c' will quit the main node, I have seen my lead to ban this command by modify erlang/OTP source code, how to do that?

Upvotes: 2

Views: 389

Answers (1)

RichardC
RichardC

Reputation: 10557

Start Erlang as erl +Bi. Note that you'll have to use init:stop() (shortcut q() in the shell) or halt() to stop the node if signals are ignored. Also, the Ctrl-G menu will not have the q option if you use this flag.

It is also possible to use +Bc, which makes Ctrl-C abort the current shell command instead of stopping the whole node. In this case, you can still use q from the Ctrl-G menu.

See http://erlang.org/doc/man/erl.html#emu_flags for the full documentation on runtime system flags.

Upvotes: 5

Related Questions