mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Fix crash when env vars contain utf8 chars
This commit is contained in:
parent
934ec7fdef
commit
dd277fd01a
1 changed files with 3 additions and 3 deletions
|
@ -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) ->
|
||||
|
|
Loading…
Reference in a new issue