From 091405bce7a59769a86fcbf8e44602c05b7082a1 Mon Sep 17 00:00:00 2001 From: Dave Thomas Date: Sun, 23 Jun 2013 20:30:38 -0500 Subject: [PATCH] Fix crsh with Unicode in environment vars --- src/rebar_utils.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 2731761..64ac4a9 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; _ -> - ReOpts = [global, unicode], + ReOpts = [global, unicode, {return, list}], 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]), - re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts ++ [{return, list}]) + re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts) end. vcs_vsn(Config, Vcs, Dir) ->