How do I modify the code search path for a remote Erlang node?

社会主义新天地 提交于 2019-12-24 11:37:35

问题


I'm connected to an Erlang node with -remsh. How do I modify the code path, in order to load a library that wasn't packaged into my release?


回答1:


All necessary functions to manipulate code loading, path... are in the code module (see doc at erlang otp code module).

You could add the system paths to the list by doing the following:

[code:add_pathz(P) || P <- filelib:wildcard("/usr/lib/erlang/lib/*/ebin")].



回答2:


After compiling some test code and connecting to a running node I was able to make it work with this:

(app@127.0.0.1)1> code:add_pathz("/path/to/my/compiled/beam").
(app@127.0.0.1)2> tester:hi().
hi!
ok
(app@127.0.0.1)3>


来源:https://stackoverflow.com/questions/22996117/how-do-i-modify-the-code-search-path-for-a-remote-erlang-node

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!