mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Fix crsh with Unicode in environment vars
This commit is contained in:
parent
dd277fd01a
commit
091405bce7
1 changed files with 2 additions and 2 deletions
|
@ -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) ->
|
||||
|
|
Loading…
Reference in a new issue