瀏覽代碼

Fix crsh with Unicode in environment vars

pull/3/head
Dave Thomas 12 年之前
父節點
當前提交
091405bce7
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      src/rebar_utils.erl

+ 2
- 2
src/rebar_utils.erl 查看文件

@ -191,12 +191,12 @@ expand_env_variable(InStr, VarName, RawVarValue) ->
%% No variables to expand %% No variables to expand
InStr; InStr;
_ -> _ ->
ReOpts = [global, unicode],
ReOpts = [global, unicode, {return, list}],
VarValue = re:replace(RawVarValue, "\\\\", "\\\\\\\\", ReOpts), 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]),
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…
取消
儲存