From dd277fd01ac6da0661df878a123db93cd09f040e Mon Sep 17 00:00:00 2001 From: Dave Thomas Date: Sat, 22 Jun 2013 21:41:04 -0500 Subject: Fix crash when env vars contain utf8 chars --- src/rebar_utils.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 9c7c064..2731761 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -191,12 +191,12 @@ expand_env_variable(InStr, VarName, RawVarValue) -> %% No variables to expand InStr; _ -> - VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", [global, unicode]), + ReOpts = [global, unicode], + VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", ReOpts), %% Use a regex to match/replace: %% Given variable "FOO": match $FOO\s | $FOOeol | ${FOO} RegEx = io_lib:format("\\\$(~s(\\s|$)|{~s})", [VarName, VarName]), - ReOpts = [global, {return, list}, unicode], - re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts) + re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts ++ [{return, list}]) end. vcs_vsn(Config, Vcs, Dir) -> -- cgit v1.1