Last active
December 20, 2022 03:20
-
-
Save Mroik/5534847ac6c32185bdc76a327699a988 to your computer and use it in GitHub Desktop.
A simple helper function to print on a remote shell in erlang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(remote_print). | |
| -export([print/3]). | |
| print(Node, String, Args) -> | |
| RemotePid = rpc:call(Node, erlang, whereis, [shell]), % Assume that on Node `register(shell, self())` was ran | |
| {group_leader, RemoteGroup} = rpc:call(Node, erlang, process_info, [RemotePid, group_leader]), | |
| spawn(Node, io, format, [RemoteGroup, String, Args]). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lookup
group_leaderwhat it is and how it affects IO