From e6d1e13966bdd130a34d9ad8cebbaee34f91094c Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 20 Aug 2011 18:33:36 +0200 Subject: [PATCH] Apply Tidier suggestions --- src/rebar_eunit.erl | 16 ++++++++-------- src/rebar_utils.erl | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl index d42ed1f..c15e934 100644 --- a/src/rebar_eunit.erl +++ b/src/rebar_eunit.erl @@ -291,17 +291,17 @@ cover_init(true, BeamFiles) -> %% to stdout. If the cover server is already started we'll reuse that %% pid. {ok, CoverPid} = case cover:start() of - {ok, P} -> - {ok, P}; + {ok, _P} = OkStart -> + OkStart; {error,{already_started, P}} -> {ok, P}; - {error, Reason} -> - {error, Reason} + {error, _Reason} = ErrorStart -> + ErrorStart end, - {ok, F} = file:open( - filename:join([?EUNIT_DIR, "cover.log"]), - [write]), + {ok, F} = OkOpen = file:open( + filename:join([?EUNIT_DIR, "cover.log"]), + [write]), group_leader(F, CoverPid), @@ -327,7 +327,7 @@ cover_init(true, BeamFiles) -> [Beam, Desc]) end, _ = [PrintWarning(Beam, Desc) || {Beam, {error, Desc}} <- Compiled], - {ok, F} + OkOpen end; cover_init(Config, BeamFiles) -> cover_init(rebar_config:get(Config, cover_enabled, false), BeamFiles). diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 8db2df2..ca254eb 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -187,13 +187,12 @@ expand_code_path() -> %% The end of form $FOO is delimited with whitespace or eol %% expand_env_variable(InStr, VarName, RawVarValue) -> - VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", - [global, {return, list}]), + ReOpts = [global, {return, list}], + VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", ReOpts), R1 = re:replace(InStr, "\\\$" ++ VarName ++ "\\s", VarValue ++ " ", [global]), R2 = re:replace(R1, "\\\$" ++ VarName ++ "\$", VarValue), - re:replace(R2, "\\\${" ++ VarName ++ "}", VarValue, - [global, {return, list}]). + re:replace(R2, "\\\${" ++ VarName ++ "}", VarValue, ReOpts). %% ====================================================================