【发布时间】:2017-08-05 04:02:40
【问题描述】:
我正在使用这个脚本运行我的 erlang 进程
#!/bin/sh
stty -f /dev/tty icanon raw
erl -pa ./ -run thing start -run init -noshell
stty echo echok icanon -raw
我的 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 时,我按键并看到字符按预期打印。当我点击转义时,shell 窗口停止响应(我必须从终端关闭窗口)。为什么会这样?
【问题讨论】:
-
尝试输入
stty sane CTRL-J。如果有帮助,erl可能会给出一个非零退出代码。