#How do you print something on the remote node console, without IO redirect to the group leader ?
5 messages · Page 1 of 1 (latest)
How do you print something on the remote node console, without IO redirect to the group leader ?
You need to set group leader for the process to match the remote group leader. https://www.erlang.org/doc/man/erlang.html#group_leader-2
When I use https://hexdocs.pm/elixir/1.12/Process.html#group_leader/2 like :
defmodule M do def loopReceive do Process.group_leader(self(),self()) receive do {:hello,msg} -> IO.puts "received #{msg}" loopReceive() end end end
I get this errror :
`11:41:47.691 [error] Process #PID<0.112.0> on node :"receiver@127.0.0.1" raised an exception
** (ErlangError) Erlang error: :calling_self:
-
1st argument: the device is not allowed to be the current process
(stdlib 4.2) io.erl:94: :io.put_chars(:standard_io, ["received hi", 10])
04ReceiveViaNetwork.exs:5: M.loopReceive/0`
line 5 is the IO.puts
You try to set self as group leader. That will not work