From c8f56c7cb239f267a12e86afdfc4b87c9052eba7 Mon Sep 17 00:00:00 2001 From: Tomas Abrahamsson Date: Thu, 29 Dec 2011 23:38:03 +0100 Subject: [PATCH] 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. --- src/rebar_eunit.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl index 2b887ee..2743b0e 100644 --- a/src/rebar_eunit.erl +++ b/src/rebar_eunit.erl @@ -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 -> [];