diff options
author | Tim Watson <tim@rabbitmq.com> | 2012-07-16 13:11:18 +0100 |
---|---|---|
committer | Tim Watson <tim@rabbitmq.com> | 2012-07-16 13:11:18 +0100 |
commit | 28db75eea769575f4312dd1eea737f1b4667589c (patch) | |
tree | f8cc2fb2ca303472ca5a479c0fd362ad08e9aef2 | |
parent | 079188669234c2522b61284bee46574410a5f158 (diff) | |
download | rabbitmq-server-bug24985.tar.gz |
handle shutdown and file system cleanup gracefullybug24985
-rwxr-xr-x | check_xref | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -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}}) -> |