Permalink
Browse files

Ensure that every new run of the rebar plugin is getting its own isol…

…ated process
  • Loading branch information...
1 parent 0edbd79 commit 40d795a418e36986bd3fd5a790c725d8da661f58 @yrashk yrashk committed Jun 28, 2011
Showing with 17 additions and 4 deletions.
  1. +17 −4 src/agner_rebar_plugin.erl
View
@@ -11,16 +11,29 @@
'get-deps'(Config, AppFile) ->
ensure_agner_started(),
set_indices(Config),
- agner_main:handle_command(fetch,[{app, AppFile},{version, "@master"},{addpath, false},
- {install, false},{build, false}]).
+ {Pid, Ref} = erlang:spawn_monitor(fun () ->
+ agner_main:handle_command(fetch,[{app, AppFile},{version, "@master"},{addpath, false},
+ {install, false},{build, false}])
+ end),
+ receive
+ {'DOWN', Ref, process, Pid, normal} ->
+ ok
+ end.
pre_compile(Config, AppFile) ->
ensure_agner_started(),
set_indices(Config),
- agner_main:handle_command(build,[{app, AppFile},{version, "@master"},{quiet, false},
+ {Pid, Ref} = erlang:spawn_monitor(fun () ->
+ agner_main:handle_command(build,[{app, AppFile},{version, "@master"},{quiet, false},
{nofetch, true},
{addpath, false},
- {install, false}]).
+ {install, false}])
+ end),
+ receive
+ {'DOWN', Ref, process, Pid, normal} ->
+ ok
+ end.
+
set_indices(Config) ->
application:set_env(agner, indices, rebar_config:get_local(Config, agner_indices, [{github,"agner"}])).

0 comments on commit 40d795a

Please sign in to comment.