mirror of
https://github.com/correl/rebar.git
synced 2024-11-24 03:00:14 +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
|
%% No variables to expand
|
||||||
InStr;
|
InStr;
|
||||||
_ ->
|
_ ->
|
||||||
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", [global, unicode]),
|
ReOpts = [global, unicode],
|
||||||
|
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", ReOpts),
|
||||||
%% Use a regex to match/replace:
|
%% Use a regex to match/replace:
|
||||||
%% Given variable "FOO": match $FOO\s | $FOOeol | ${FOO}
|
%% Given variable "FOO": match $FOO\s | $FOOeol | ${FOO}
|
||||||
RegEx = io_lib:format("\\\$(~s(\\s|$)|{~s})", [VarName, VarName]),
|
RegEx = io_lib:format("\\\$(~s(\\s|$)|{~s})", [VarName, VarName]),
|
||||||
ReOpts = [global, {return, list}, unicode],
|
re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts ++ [{return, list}])
|
||||||
re:replace(InStr, RegEx, [VarValue, "\\2"], ReOpts)
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
vcs_vsn(Config, Vcs, Dir) ->
|
vcs_vsn(Config, Vcs, Dir) ->
|
||||||
|
|
Loading…
Reference in a new issue