mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Check $ancestors for kernel OTP app processes to not kill
This commit is contained in:
parent
0627075dd6
commit
9c8b5e6c82
1 changed files with 22 additions and 9 deletions
|
@ -499,20 +499,33 @@ kill_extras(Pids) ->
|
||||||
%% 1. Interfere with stuff that we don't want interfered with, or
|
%% 1. Interfere with stuff that we don't want interfered with, or
|
||||||
%% 2. May/will force the 'kernel' app to shutdown, which *will*
|
%% 2. May/will force the 'kernel' app to shutdown, which *will*
|
||||||
%% interfere with rebar's ability To Do Useful Stuff(tm).
|
%% interfere with rebar's ability To Do Useful Stuff(tm).
|
||||||
KeepProcs = [cover_server, eunit_server, inet_gethost_native_sup,
|
%% This list may require changes as OTP versions and/or
|
||||||
inet_gethost_native, timer_server],
|
%% rebar use cases change.
|
||||||
|
KeepProcs = [cover_server, eunit_server,
|
||||||
|
eqc, eqc_license, eqc_locked],
|
||||||
Killed = [begin
|
Killed = [begin
|
||||||
Info = case erlang:process_info(Pid) of
|
Info = case erlang:process_info(Pid) of
|
||||||
undefined -> [];
|
undefined -> [];
|
||||||
Else -> Else
|
Else -> Else
|
||||||
end,
|
end,
|
||||||
Keep = case proplists:get_value(registered_name, Info) of
|
Keep1 = case proplists:get_value(registered_name, Info) of
|
||||||
undefined ->
|
undefined ->
|
||||||
false;
|
false;
|
||||||
Name ->
|
Name ->
|
||||||
lists:member(Name, KeepProcs)
|
lists:member(Name, KeepProcs)
|
||||||
end,
|
end,
|
||||||
if Keep ->
|
Keep2 = case proplists:get_value(dictionary, Info) of
|
||||||
|
undefined ->
|
||||||
|
false;
|
||||||
|
Ds ->
|
||||||
|
case proplists:get_value('$ancestors', Ds) of
|
||||||
|
undefined ->
|
||||||
|
false;
|
||||||
|
As ->
|
||||||
|
lists:member(kernel_sup, As)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
if Keep1 orelse Keep2 ->
|
||||||
ok;
|
ok;
|
||||||
true ->
|
true ->
|
||||||
?DEBUG("Kill ~p ~p\n", [Pid, Info]),
|
?DEBUG("Kill ~p ~p\n", [Pid, Info]),
|
||||||
|
|
Loading…
Reference in a new issue