Skip to content

Commit

Permalink
Fix port crash
Browse files Browse the repository at this point in the history
Reported in GH issues #7735
  • Loading branch information
dgud committed Oct 18, 2023
1 parent b89879e commit 6317d72
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/runtime_tools/src/observer_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,21 @@ get_mnesia_loop(Parent, {Match, Cont}) ->

get_port_list() ->
ExtraItems = [monitors,monitored_by,parallelism,locking,queue_size,memory],
[begin
[{port_id,P}|erlang:port_info(P)] ++
port_info(P,ExtraItems) ++
inet_port_extra(erlang:port_info(P, name), P)
end || P <- erlang:ports()].
PortInfo =
fun(P, Acc) ->
case erlang:port_info(P) of
undefined ->
Acc;
Info ->
[
[{port_id,P}|Info] ++
port_info(P,ExtraItems) ++
inet_port_extra(erlang:port_info(P, name), P)
| Acc ]
end
end,
PIs = lists:foldl(PortInfo, [], erlang:ports()),
lists:reverse(PIs).

port_info(P,[Item|Items]) ->
case erlang:port_info(P,Item) of
Expand Down

0 comments on commit 6317d72

Please sign in to comment.