mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Fix handling of {already_started,Pid} from cover:start
Previous patch erroneously assumed that cover:start() returned {already_started,Pid} in the cases where cover was already started. We now turn {error,{already_started,Pid}} into {ok, Pid} and return {error, Reason} if we encounter an error we do not know about, this will cause a nice and violent badmatch to stop everything.
This commit is contained in:
parent
2911d48fb1
commit
6736e3147e
1 changed files with 10 additions and 2 deletions
|
@ -288,8 +288,16 @@ cover_init(false, _BeamFiles) ->
|
|||
cover_init(true, BeamFiles) ->
|
||||
%% Attempt to start the cover server, then set it's group leader to
|
||||
%% .eunit/cover.log, so all cover log messages will go there instead of
|
||||
%% to stdout.
|
||||
{_,CoverPid} = cover:start(),
|
||||
%% to stdout. If the cover server is already started we'll reuse that
|
||||
%% pid.
|
||||
{ok, CoverPid} = case cover:start() of
|
||||
{ok, P} ->
|
||||
{ok, P};
|
||||
{error,{already_started, P}} ->
|
||||
{ok, P};
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
end,
|
||||
|
||||
{ok, F} = file:open(
|
||||
filename:join([?EUNIT_DIR, "cover.log"]),
|
||||
|
|
Loading…
Reference in a new issue