C Erlang进程在试图自杀时挂起
我正在用这个脚本运行我的erlang进程C Erlang进程在试图自杀时挂起,c,bash,erlang,C,Bash,Erlang,我正在用这个脚本运行我的erlang进程 #!/bin/sh stty -f /dev/tty icanon raw erl -pa ./ -run thing start -run init -noshell stty echo echok icanon -raw my Erlang进程: -module(thing). -compile(export_all). process(<<27>>) -> io:fwrite("Ch: ~w", [<&l
#!/bin/sh
stty -f /dev/tty icanon raw
erl -pa ./ -run thing start -run init -noshell
stty echo echok icanon -raw
my Erlang进程:
-module(thing).
-compile(export_all).
process(<<27>>) ->
io:fwrite("Ch: ~w", [<<27>>]),
exit(normal);
process(Ch) ->
io:fwrite("Ch: ~w", [Ch]),
get_char().
get_char() ->
Ch = io:get_chars("p: ", 1),
process(Ch).
start() ->
io:setopts([{binary, true}]),
get_char().
当我运行./invoke.sh时,我按键并看到字符按预期打印。当我点击escape时,外壳窗口停止响应,我必须从终端关闭窗口。为什么会发生这种情况?当您调用exit/1时,它只会终止erlang进程,而不会停止erlang运行时系统。由于您在没有外壳的情况下运行,因此会出现窗口不响应的行为。如果您从任务管理器或通过pkill杀死beam进程,您将获得返回的命令行。
一个简单的解决办法是更换
现存的
具有
暂停尝试键入stty sane CTRL-J。如果有帮助,erl可能会给出一个非零exitcode。