summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Watson <tim@rabbitmq.com>2012-07-16 13:11:18 +0100
committerTim Watson <tim@rabbitmq.com>2012-07-16 13:11:18 +0100
commit28db75eea769575f4312dd1eea737f1b4667589c (patch)
treef8cc2fb2ca303472ca5a479c0fd362ad08e9aef2
parent079188669234c2522b61284bee46574410a5f158 (diff)
downloadrabbitmq-server-bug24985.tar.gz
handle shutdown and file system cleanup gracefullybug24985
-rwxr-xr-xcheck_xref24
1 files changed, 14 insertions, 10 deletions
diff --git a/check_xref b/check_xref
index 6eb89e15..8f65f3b1 100755
--- a/check_xref
+++ b/check_xref
@@ -34,14 +34,18 @@ main([PluginsDir|Argv]) ->
false -> ok;
true -> os:cmd("rm -rf " ++ LibDir)
end,
-
- try
- check(Cwd, PluginsDir, LibDir, checks())
- after
- %% TODO: bootstrap file_handle_cache and use
- %% rabbit_file:recursive_delete instead of this...
- os:cmd("rm -rf " ++ LibDir)
- end.
+ Rc = try
+ check(Cwd, PluginsDir, LibDir, checks())
+ catch
+ _:Err ->
+ io:format(user, "failed: ~p~n", [Err]),
+ 1
+ end,
+ shutdown(Rc, LibDir).
+
+shutdown(Rc, LibDir) ->
+ os:cmd("rm -rf " ++ LibDir),
+ erlang:halt(Rc).
check(Cwd, PluginsDir, LibDir, Checks) ->
{ok, Plugins} = file:list_dir(PluginsDir),
@@ -220,8 +224,8 @@ report(Results) ->
report(info, "Completed: ~p errors, ~p warnings~n",
[length(Errors), length(Warnings)]),
case length(Errors) > 0 of
- true -> halt(1);
- false -> halt(0)
+ true -> 1;
+ false -> 0
end.
report_failures({analysis_error, {Mod, Reason}}) ->