From a14f75013113f63434a8aa0295ce2be0f0fdedc3 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Wed, 18 Feb 2015 06:22:22 -0800 Subject: fix error where an exception in ct could hang rebar by monitoring the process where ct is performed --- src/rebar_prv_common_test.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index a55faa2..b697d37 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -76,9 +76,9 @@ run_test(CTOpts, true) -> run_test(CTOpts, false) -> Pid = self(), LogDir = proplists:get_value(logdir, CTOpts), - erlang:spawn(fun() -> + erlang:spawn_monitor(fun() -> {ok, F} = file:open(filename:join([LogDir, "ct.latest.log"]), - [write]), + [write]), true = group_leader(F, self()), Pid ! ct:run_test(CTOpts) end), @@ -369,4 +369,6 @@ handle_quiet_results(CTOpts, {_, Failed, _}) -> LogDir = proplists:get_value(logdir, CTOpts), Index = filename:join([LogDir, "index.html"]), io:format(" ~p tests failed.~n Results written to ~p.~n", [Failed, Index]); +handle_quiet_results(_CTOpts, {'DOWN', _, _, _, Reason}) -> + handle_results({error, Reason}); handle_quiet_results(_CTOpts, Result) -> handle_results(Result). -- cgit v1.1