【发布时间】:2016-07-15 01:53:29
【问题描述】:
我正在构建一个系统,该系统需要使用以前构建的 OTP 应用程序(我们称之为 X)。例如,如果我想构建一个新的 OTP 应用程序/模块,我该如何使用模块中已经存在的应用程序?
我假设我可以调用start,因为它遵循application 的行为,所以我构建了一个具有以下代码的简约应用程序 Y:
y.erl:
-module(y).
-behaviour(application).
start(_StartType, _StartArgs) ->
io:format("going to call x_app~n"),
{ok, _} = x_app:start([]),
io:format("called x_app~n"),
y:start_link().
stop(_State) ->
ok = x_app:stop([]),
ok.
Rebar 成功编译了这段代码,没有产生任何警告。rel/y/bin/y start 什么都不输出(我希望得到至少一个io:format 的输出)
rel/y/bin/y stop 输出Node is not running!
【问题讨论】:
标签: erlang erlang-otp erlang-shell