我有一个简单的 Erlang 命令,我想通过它调用erl -eval
(编译 erlydtl 模板,如上所述埃尔利德尔页面 https://code.google.com/p/erlydtl/wiki/Overview).
当我从 shell 交互地执行此操作时,一切正常并且命令立即退出:
erl -pa ebin deps\erlydtl\ebin Eshell V5.9.3.1 (abort with ^G)
1> erlydtl:compile('templates/tictactoe.dtl',tictactoe_dtl,[{out_dir,'ebin'}]).
ok
但是当我尝试通过erl -eval
(我想从 .bat 文件运行它):
erl -pa ebin deps\erlydtl\ebin -noshell -eval erlydtl:compile('templates/tictactoe.dtl',tictactoe_dtl,[{out_dir,'ebin'}])
然后该命令完成其工作(模板已编译),但它不会退出,我需要使用 ctrl+c 手动终止 shell 进程(我在 Windows 下工作)。
我只想要编译模板并退出的命令。可能是什么问题?
Update:
一种解决方案可能是在命令末尾附加 exit() 调用,但最终我得到以下结果:
erl -pa ebin deps\erlydtl\ebin -noshell -eval erlydtl:compile('templates/tictactoe.dtl',tictactoe_dtl,[{out_dir,'ebin'}]),exit(success).
{"init terminating in do_boot",success}
Crash dump was written to: erl_crash.dump
init terminating in do_boot (success)
错误消息非常令人恼火,所以我仍然不喜欢这个解决方案。