Erlang:RPC到具有该节点上的输出的节点 [英] Erlang : RPC to a node with output on that node

查看:144
本文介绍了Erlang:RPC到具有该节点上的输出的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法对节点进行rpc调用,但是在该节点上显示输出,而不仅仅是在调用节点上(实际上如果调用节点没有显示输出,我不会太麻烦)



虽然我明白我可以使用

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

,这将在Node上显示someTerm,我真正想要的是获得一个执行方法显示在远程节点终端上,以便在节点上尝试运行ls:

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

它将实际将文件夹内容的结果写入Node的终端。



这个想法是,我可以从单个节点驱动演示文稿,但是我正在驾驶的节点显示其上的操作历史。

解决方案

尝试; - )

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

或者您想要在节点上显示

  spawn(Node,fun() - > group_leader(whereis(user),self()),c:ls ) 结束)。 

或更多有趣的例子,将本地进程的输出重定向到另一个终端节点

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


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()).

这篇关于Erlang:RPC到具有该节点上的输出的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆