浏览代码

Fix common test run duplication on windows

pull/489/head
Viacheslav Kovalev 10 年前
父节点
当前提交
a753bbeafc
共有 3 个文件被更改,包括 9 次插入5 次删除
  1. +3
    -3
      src/rebar_agent.erl
  2. +5
    -1
      src/rebar_dir.erl
  3. +1
    -1
      src/rebar_git_resource.erl

+ 3
- 3
src/rebar_agent.erl 查看文件

@ -20,7 +20,7 @@ do(Namespace, Command) when is_atom(Namespace), is_atom(Command) ->
gen_server:call(?MODULE, {cmd, Namespace, Command}, infinity).
init(State) ->
{ok, Cwd} = file:get_cwd(),
Cwd = rebar_dir:get_cwd(),
{ok, #state{state=State, cwd=Cwd}}.
handle_call({cmd, Command}, _From, State=#state{state=RState, cwd=Cwd}) ->
@ -48,8 +48,8 @@ terminate(_Reason, _State) ->
run(Namespace, Command, RState, Cwd) ->
try
case file:get_cwd() of
{ok, Cwd} ->
case rebar_dir:get_cwd() of
Cwd ->
Args = [atom_to_list(Namespace), atom_to_list(Command)],
CmdState0 = refresh_state(RState, Cwd),
CmdState1 = rebar_state:set(CmdState0, task, atom_to_list(Command)),

+ 5
- 1
src/rebar_dir.erl 查看文件

@ -100,7 +100,11 @@ local_cache_dir(Dir) ->
get_cwd() ->
{ok, Dir} = file:get_cwd(),
Dir.
%% On windows cwd may return capital letter for drive,
%% for example C:/foobar. But as said in http://www.erlang.org/doc/man/filename.html#join-1
%% filename:join/1,2 anyway will convert drive-letter to lowercase, so we have to "internalize"
%% cwd as soon as it possible.
filename:join([Dir]).
template_globals(State) ->
filename:join([global_config_dir(State), "templates", "globals"]).

+ 1
- 1
src/rebar_git_resource.erl 查看文件

@ -109,7 +109,7 @@ download(Dir, {git, Url, Rev}, _State) ->
rebar_utils:sh(?FMT("git checkout -q ~s", [Rev]), [{cd, Dir}]).
make_vsn(Dir) ->
{ok, Cwd} = file:get_cwd(),
Cwd = rebar_dir:get_cwd(),
try
ok = file:set_cwd(Dir),
{Vsn, RawRef, RawCount} = collect_default_refcount(),

正在加载...
取消
保存