Skip to content

Commit

Permalink
Fix crash read ets (#94)
Browse files Browse the repository at this point in the history
* fix: crash when ets:info/1 return undefined

* chore: bump to 1.7.4
  • Loading branch information
zhongwencool committed Nov 23, 2022
1 parent c9aca6f commit 536caee
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Visualize Erlang/Elixir Nodes On The Command Line base on [recon](https://github
%% rebar.config
{deps, [observer_cli]}
%% erlang.mk
dep_observer_cli = hex 1.7.3
dep_observer_cli = hex 1.7.4
```

**Elixir**
Expand Down Expand Up @@ -256,6 +256,8 @@ Support F/B to page up/down.

### Changelog

- 1.7.4
- fix crash when ets:info/1 return undefined.
- 1.7.3
- fix system pane exception by `ps` command.
- 1.7.2
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule ObserverCli.MixProject do
def project do
[
app: :observer_cli,
version: "1.7.3",
version: "1.7.4",
language: :erlang,
description: "observer in shell",
deps: [
Expand Down
2 changes: 1 addition & 1 deletion src/observer_cli.app.src
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{application, observer_cli,
[
{description, "Visualize Erlang Nodes On The Command Line"},
{vsn, "1.7.3"},
{vsn, "1.7.4"},
{modules, [
observer_cli
]},
Expand Down
45 changes: 25 additions & 20 deletions src/observer_cli_ets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,9 @@ render_ets_info(Rows, CurPage, Attr) ->
get_ets_info(Tab, Attr) ->
case catch ets:info(Tab) of
{'EXIT', _} ->
{
0,
0,
[
%%it maybe die
{name, unread},
{write_concurrency, unread},
{read_concurrency, unread},
{compressed, unread},
{memory, unread},
{owner, unread},
{heir, unread},
{size, unread},
{node, unread},
{named_table, unread},
{type, unread},
{keypos, unread},
{protection, unread}
]
};
unread();
undefined ->
unread();
Info when is_list(Info) ->
Owner = proplists:get_value(owner, Info),
NewInfo =
Expand All @@ -169,3 +152,25 @@ is_reg(Owner) ->
{registered_name, Name} -> Name;
_ -> Owner
end.

unread() ->
{
0,
0,
[
%%it maybe die
{name, unread},
{write_concurrency, unread},
{read_concurrency, unread},
{compressed, unread},
{memory, unread},
{owner, unread},
{heir, unread},
{size, unread},
{node, unread},
{named_table, unread},
{type, unread},
{keypos, unread},
{protection, unread}
]
}.

0 comments on commit 536caee

Please sign in to comment.