概要
paiza.ioでelixirやってみた。
Node、やってみた。
サンプルコード
IO.inspect(node())
IO.inspect(Node.get_cookie())
IO.inspect(:global.registered_names())
IO.inspect(:erl_epmd.names())
IO.inspect(File.cwd!())
System.get_env()
|> IO.inspect
IO.inspect(Node.list())
IO.inspect(Node.list(:this))
System.cmd("epmd", ["-daemon"])
|> IO.inspect
#Node.start(:example, :shortnames, 15000)
#Node.start(:example, :longnames)
Node.start(:"test@ohisama.llc")
|> IO.inspect
Node.set_cookie(:SOMECOOKIE)
IO.inspect(Node.get_cookie())
Node.self()
|> IO.inspect
実行結果
:nonode@nohost
:nocookie
[]
{:error, :address}
"/workspace"
%{
"BINDIR" => "/usr/lib/erlang/erts-10.6.4/bin",
"EMU" => "beam",
"HOME" => "/workspace",
"HOSTNAME" => "da8a866c7e4f",
"LANG" => "en_US.UTF-8",
"PATH" => "/usr/lib/erlang/erts-10.6.4/bin:/usr/lib/erlang/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"PROGNAME" => "erl",
"PWD" => "/workspace",
"ROOTDIR" => "/usr/lib/erlang",
"RUNNER_USER" => "runner3"
}
[]
[:nonode@nohost]
{"", 0}
{:ok, #PID<0.97.0>}
:SOMECOOKIE
:"test@ohisama.llc"
成果物
以上。