diff options
author | Jared Morrow <jared@basho.com> | 2014-03-05 12:52:43 -0700 |
---|---|---|
committer | Jared Morrow <jared@basho.com> | 2014-03-05 12:52:43 -0700 |
commit | b7e727a8f7128d1686090c51a264b0051eac0be2 (patch) | |
tree | ac427da8ff8474e15b6f401f68e5d13745c20c73 /src | |
parent | 077f8e064a8b07824e4a639aefad9e87df02de62 (diff) | |
parent | 4993a83820459815ec5f3b4965b8108343016ea8 (diff) |
Merge pull request #98 from jcomellas/jc-no-erl-libs-repetition
Repetition of environment variable definitions in child processes (ports)
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_port_compiler.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl index 0abb044..fec8e04 100644 --- a/src/rebar_port_compiler.erl +++ b/src/rebar_port_compiler.erl @@ -498,10 +498,20 @@ erts_dir() -> os_env() -> ReOpts = [{return, list}, {parts, 2}, unicode], - Os = [list_to_tuple(re:split(S, "=", ReOpts)) || S <- os:getenv()], + Os = [list_to_tuple(re:split(S, "=", ReOpts)) || + S <- lists:filter(fun discard_deps_vars/1, os:getenv())], %% Drop variables without a name (win32) [T1 || {K, _V} = T1 <- Os, K =/= []]. +%% +%% To avoid having multiple repetitions of the same environment variables +%% (ERL_LIBS), avoid exporting any variables that may cause conflict with +%% those exported by the rebar_deps module (ERL_LIBS, REBAR_DEPS_DIR) +%% +discard_deps_vars("ERL_LIBS=" ++ _Value) -> false; +discard_deps_vars("REBAR_DEPS_DIR=" ++ _Value) -> false; +discard_deps_vars(_Var) -> true. + select_compile_template(drv, Compiler) -> select_compile_drv_template(Compiler); select_compile_template(exe, Compiler) -> |