Don't kill any inet_gethost_native after eunit

Avoid error reports like this one:

  prompt$ rebar eunit
  ==> dummy (eunit)
    Test passed.

  =ERROR REPORT==== 29-Dec-2011::23:22:11 ===
  ** Generic server inet_gethost_native_sup terminating
  ** Last message in was {'EXIT',<0.62.0>,killed}
  ** When Server state == {state,inet_gethost_native,undefined,<0.62.0>,
                                 {local,inet_gethost_native_sup}}
  ** Reason for termination ==
  ** killed

Previously, it could happen if an eunit test did something that
required a name lookup, like in this example:

  -module(dummy_tests).
  -include_lib("eunit/include/eunit.hrl").

  x_test() ->
      {ok, _Hostent} = inet:gethostbyname(localhost).

The inet_gethost_native is a process, started on demand, under a
supervisor_bridge under the kernel_sup, but it is not a gen_server
process or the like, so it has nothing in '$ancestors' in its process
dictionary to indicate it is part of kernel.
This commit is contained in:
Tomas Abrahamsson 2011-12-29 23:38:03 +01:00
parent f47d61bc13
commit c8f56c7cb2

View file

@ -477,7 +477,11 @@ kill_extras(Pids) ->
%% This list may require changes as OTP versions and/or
%% rebar use cases change.
KeepProcs = [cover_server, eunit_server,
eqc, eqc_license, eqc_locked],
eqc, eqc_license, eqc_locked,
%% inet_gethost_native is started on demand, when
%% doing name lookups. It is under kernel_sup, under
%% a supervisor_bridge.
inet_gethost_native],
Killed = [begin
Info = case erlang:process_info(Pid) of
undefined -> [];