#How do you print something on the remote node console, without IO redirect to the group leader ?

5 messages · Page 1 of 1 (latest)

pliant lotus
#

I tried with IO.puts(self(),"message")on the remote node but received this error : * 1st argument: the device is not allowed to be the current process
Any other idea ?

#

How do you print something on the remote node console, without IO redirect to the group leader ?

north brook
pliant lotus
#

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

north brook
#

You try to set self as group leader. That will not work