mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Replace sleep with pause_until_net_kernel_stopped()
This commit is contained in:
parent
34dd0ccdd9
commit
f79290dc9c
1 changed files with 17 additions and 1 deletions
|
@ -472,7 +472,7 @@ reset_after_eunit({OldProcesses, WasAlive, OldAppEnvs, _OldACs}) ->
|
||||||
?DEBUG("Stopping net kernel....\n", []),
|
?DEBUG("Stopping net kernel....\n", []),
|
||||||
erl_epmd:stop(),
|
erl_epmd:stop(),
|
||||||
net_kernel:stop(),
|
net_kernel:stop(),
|
||||||
timer:sleep(100);
|
pause_until_net_kernel_stopped();
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
|
@ -553,3 +553,19 @@ wait_until_dead(Pid) when is_pid(Pid) ->
|
||||||
end;
|
end;
|
||||||
wait_until_dead(_) ->
|
wait_until_dead(_) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
pause_until_net_kernel_stopped() ->
|
||||||
|
pause_until_net_kernel_stopped(10).
|
||||||
|
|
||||||
|
pause_until_net_kernel_stopped(0) ->
|
||||||
|
exit(net_kernel_stop_failed);
|
||||||
|
pause_until_net_kernel_stopped(N) ->
|
||||||
|
try
|
||||||
|
_ = net_kernel:i(),
|
||||||
|
timer:sleep(100),
|
||||||
|
pause_until_net_kernel_stopped(N - 1)
|
||||||
|
catch
|
||||||
|
error:badarg ->
|
||||||
|
?DEBUG("Stopped net kernel.\n", []),
|
||||||
|
ok
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in a new issue