summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-06-17 16:11:59 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-06-17 16:11:59 +0200
commit0f961d86c6306e1aacae04218d31c8c51081c5bd (patch)
tree031f42b71f6a46e1c4f457c6b08f314337921495
parentd7037165fded9eb4685407ec48dc8d89ba1b98c5 (diff)
Fix #247 (Reported-by: Uvarov Michael)
-rw-r--r--src/rebar_port_compiler.erl3
-rw-r--r--src/rebar_utils.erl6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl
index 4163dd4..22acff6 100644
--- a/src/rebar_port_compiler.erl
+++ b/src/rebar_port_compiler.erl
@@ -487,8 +487,7 @@ expand_keys_in_value([Key | Rest], Value, Vars) ->
expand_command(TmplName, Env, InFiles, OutFile) ->
Cmd0 = proplists:get_value(TmplName, Env),
Cmd1 = rebar_utils:expand_env_variable(Cmd0, "PORT_IN_FILES", InFiles),
- Cmd2 = rebar_utils:expand_env_variable(Cmd1, "PORT_OUT_FILE", OutFile),
- re:replace(Cmd2, "\\\$\\w+|\\\${\\w+}", "", [global, {return, list}]).
+ rebar_utils:expand_env_variable(Cmd1, "PORT_OUT_FILE", OutFile).
%%
%% Given a string, determine if it is expandable
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index 8f71bab..abe837a 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -337,10 +337,12 @@ get_deprecated_3(Get, Config, OldOpt, NewOpt, Default, When) ->
patch_on_windows(Cmd, Env) ->
case os:type() of
{win32,nt} ->
- "cmd /q /c "
+ Cmd1 = "cmd /q /c "
++ lists:foldl(fun({Key, Value}, Acc) ->
expand_env_variable(Acc, Key, Value)
- end, Cmd, Env);
+ end, Cmd, Env),
+ %% Remove left-over vars
+ re:replace(Cmd1, "\\\$\\w+|\\\${\\w+}", "", [global, {return, list}]);
_ ->
Cmd
end.