From b10224be6284a522b384f2319d00432629c1e7dc Mon Sep 17 00:00:00 2001 From: Jan Kloetzke Date: Tue, 1 Nov 2011 19:17:01 +0100 Subject: [PATCH] Fix rebar_utils:expand_env_variable/3 The function may fail with a badarg exception because the first regex returns an iolist() which is allowed to be a improper list. In this case '++' cannot append to the iolist. The correct way to append something to an iolist() is [iolist(), "tail"] because iolist's are allowed to be arbitrarily deep lists. --- src/rebar_utils.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index a32adfd..ce84a57 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -196,7 +196,7 @@ expand_env_variable(InStr, VarName, RawVarValue) -> %% Given variable "FOO": match $FOO\s | $FOOeol | ${FOO} RegEx = io_lib:format("\\\$(~s(\\s|$)|{~s})", [VarName, VarName]), ReOpts = [global, {return, list}], - re:replace(InStr, RegEx, VarValue ++ "\\2", ReOpts) + re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts) end.