简体   繁体   中英

Erlang : RPC to a node with output on that node

Is there a way to make an rpc call to a node, but have the output displayed on that node, not just on the calling node ( in fact I would not be too bothered if the calling node did not display the output ).

While I understand that I can use

rpc:call( Node, erlang, display, [ someTerm ] ).

and that will display "someTerm" on Node, what I really want is to get the result of an executed method displayed on the remote node terminal, so that given the attempt to run ls on Node :

rpc:call( Node, c, ls, [] ).

it will actually write the results the folder contents to the terminal of Node.

The idea being that I can drive a presentation from a single node, but have the nodes I am driving display the history of actions on them.

Try ;-)

rpc:call( Node, c, ls, [] ).

or when you want display it on Node

spawn(Node, fun()->group_leader(whereis(user),self()), c:ls() end).

or much more funny example which redirect output of local process to another terminal of Node

group_leader(rpc:call(Node, erlang, whereis, [user]), self()),
c:ls(),
group_leader(whereis(user), self()).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM