[erlang-questions] net_kernel:start/1 doesn't honor ERL_EPMD_PORT set by os:putenv/2
Khitai Pang
khitai.pang@REDACTED
Fri Mar 11 05:48:20 CET 2016
Hi,
I have the following code:
os:putenv("ERL_EPMD_ADDRESS", inet_parse:ntoa(IP)),
os:putenv("ERL_EPMD_PORT", integer_to_list(5555)),
os:cmd("epmd -daemon"),
net_kernel:start([bob, longnames]),
The ERL_EPMD_ADDRESS and ERL_EPMD_PORT environment variables are used by
os:cmd("epmd -daemon") but net_kernel:start/1 fails:
Protocol: "inet_tcp": register/listen error: econnrefused
Apparently it still tries to connect to 4369, where no process is listening.
If I start erl by "ERL_EPMD_PORT=5555 erl", net_kernel:start/1 in the
above code works fine.
So I have come to the conclusion that environment variables set by
os:putenv/2 are not honored by net_kernel:start/1. Am I right? If yes,
1) is this a bug? 2) for a Erlang/OTP release, how to automatically set
global environment variables for erl?
Thanks
Khitai
More information about the erlang-questions
mailing list