Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/observer/src/etop.erl
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ stop() ->
case whereis(etop_server) of
undefined -> not_started;
Pid when is_pid(Pid) ->
Result = etop_server ! stop,
MonRef = monitor(process, Pid),
Pid ! stop,
stop_etop_input_server(),
Result
receive {'DOWN', MonRef, process, Pid, _} -> ok end,
stop
end.

-doc """
Expand Down Expand Up @@ -328,7 +330,13 @@ stop(Reader, Opts) ->
etop_tr:stop_tracer(Opts),
%% Stop reader process so it doesn't crash on deleted accumulator table
%% when our process dies.
exit(Pid, stop);
case is_process_alive(Pid) of
true ->
MonRef = monitor(process, Pid),
exit(Pid, stop),
receive {'DOWN', MonRef, process, Pid, _} -> ok end;
false -> ok
end;
_ ->
ok
end,
Expand Down
5 changes: 2 additions & 3 deletions lib/observer/test/etop_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ text_in_terminal(Config) when is_list(Config) ->
Node = proplists:get_value(node, Config),
Term = proplists:get_value(term, Config),
ExpectedLineCount = 10 + proplists:get_value(lines, Config, 10) + 2,

EtopStartCmd = "spawn_link(etop, start, [[{node,"++atom_to_list(Node)++"},{output,text},{interval,1}]]).",
EtopStartCmd = io_lib:format("spawn_link(etop, start, [[{node,~w},{output,text},{interval,1}]]).", [Node]),
shell_test_lib:send_tty(Term, EtopStartCmd),
shell_test_lib:send_tty(Term, "Enter"),

Expand Down Expand Up @@ -406,8 +405,8 @@ verify_dup_line(Char, Line) ->
true = string:equal(ExpectedLine, Line).

verify_node_and_time_line(Node, NodeAndTimeLine) ->
NodeString = atom_to_binary(Node),
[NodeString | SplitLine] = string:split(string:trim(NodeAndTimeLine), " ", all),
Node = binary_to_atom(string:trim(NodeString, both, "'")),

TimeLine = lists:last(SplitLine),
[Hour, Minute, Second] = string:split(TimeLine, ":", all),
Expand Down
Loading