diff options
author | Tristan Sloughter <t@crashfast.com> | 2014-09-27 14:49:53 -0500 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2014-09-27 14:49:53 -0500 |
commit | db9ba68f801ec961313d0cdf9ceb03d79cc84d09 (patch) | |
tree | 874efc645d5c41d194632f57cb9a37d473da0051 /src | |
parent | b4ad8a8eb400a08bb95c7a86daa89f0b3a9c5f89 (diff) |
erorr message on failed package update
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_prv_update.erl | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl index c885167..bfe3ab6 100644 --- a/src/rebar_prv_update.erl +++ b/src/rebar_prv_update.erl @@ -11,7 +11,7 @@ -include("rebar.hrl"). -define(PROVIDER, update). --define(DEPS, [lock]). +-define(DEPS, []). %% =================================================================== %% Public API @@ -46,22 +46,17 @@ do(State) -> end; [] -> ?INFO("Updating package index...~n", []), - Url = url(State), - %{ok, [Home]} = init:get_argument(home), - ec_file:mkdir_p(filename:join([os:getenv("HOME"), ".rebar"])), - PackagesFile = filename:join([os:getenv("HOME"), ".rebar", "packages"]), - {ok, RequestId} = httpc:request(get, {Url, []}, [], [{stream, PackagesFile}, {sync, false}]), - wait(RequestId, State) - end. - -wait(RequestId, State) -> - receive - {http, {RequestId, saved_to_file}} -> - {ok, State} - after - 500 -> - io:format("."), - wait(RequestId, State) + try + Url = url(State), + %{ok, [Home]} = init:get_argument(home), + ec_file:mkdir_p(filename:join([os:getenv("HOME"), ".rebar"])), + PackagesFile = filename:join([os:getenv("HOME"), ".rebar", "packages"]), + {ok, RequestId} = httpc:request(get, {Url, []}, [], [{stream, PackagesFile} + ,{sync, true}]) + catch + _:_ -> + {error, io_lib:format("Failed to write package index.~n", [])} + end end. url(State) -> |