Skip to content

Commit bcc92cc

Browse files
fishcakezJosé Valim
authored andcommitted
Support remote pids/ports with IEx helper i/1
Signed-off-by: José Valim <[email protected]>
1 parent d64d4b0 commit bcc92cc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/iex/lib/iex/info.ex

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,14 @@ defimpl IEx.Info, for: PID do
227227

228228
def info(pid) do
229229
extra =
230-
if info = Process.info(pid, @keys) do
231-
["Alive": true,
232-
"Name": process_name(info[:registered_name]),
233-
"Links": links(info[:links]),
234-
"Message queue length": info[:message_queue_len]]
235-
else
236-
["Alive": false]
230+
case :rpc.pinfo(pid, @keys) do
231+
[_|_] = info ->
232+
["Alive": true,
233+
"Name": process_name(info[:registered_name]),
234+
"Links": links(info[:links]),
235+
"Message queue length": info[:message_queue_len]]
236+
_ ->
237+
["Alive": false]
237238
end
238239

239240
["Data type": "PID"] ++ extra ++
@@ -257,9 +258,10 @@ end
257258

258259
defimpl IEx.Info, for: Port do
259260
def info(port) do
260-
port_info = Port.info(port)
261+
connected = :rpc.call(node(port), :erlang, :port_info, [port, :connected])
262+
261263
["Data type": "Port",
262-
"Open": port_info != nil,
264+
"Open": match?({:connected, _}, connected),
263265
"Reference modules": "Port"]
264266
end
265267
end

0 commit comments

Comments
 (0)