test: use try catch instaed of sopan a process

This commit is contained in:
Zaiming (Stone) Shi 2022-03-23 13:51:13 +01:00
parent 929ca787f4
commit 1c448d6016
1 changed files with 5 additions and 4 deletions

View File

@ -396,9 +396,10 @@ unmock_print() ->
meck:unload(emqx_ctl).
safe_unmeck(Module) ->
%% isolate exits
{Pid, Ref} = erlang:spawn_monitor(fun() -> meck:unload(Module) end),
receive
{'DOWN', Ref, process, Pid, _} ->
try
meck:unload(Module),
ok
catch
_ : _ ->
ok
end.