瀏覽代碼

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
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…
取消
儲存