aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reltool/bin/reltool.escript
diff options
context:
space:
mode:
Diffstat (limited to 'lib/reltool/bin/reltool.escript')
-rw-r--r--lib/reltool/bin/reltool.escript10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/reltool/bin/reltool.escript b/lib/reltool/bin/reltool.escript
index 567cafbcad..1e5f34d99d 100644
--- a/lib/reltool/bin/reltool.escript
+++ b/lib/reltool/bin/reltool.escript
@@ -27,14 +27,14 @@ main(Args) ->
{Options, Actions} = parse_args(Tokens, []),
case invoke(Options, Actions) of
ok ->
- erlang:halt(0);
+ safe_stop(0);
{error, ReasonString} ->
fatal_error(ReasonString, 2)
end
catch
throw:usage ->
usage(),
- erlang:halt(1);
+ safe_stop(1);
exit:Reason ->
String = lists:flatten(io_lib:format("EXIT: ~p", [Reason])),
fatal_error(String, 3)
@@ -59,6 +59,10 @@ usage() ->
"See User's guide and Reference manual for more info.\n",
[String]).
+safe_stop(Code) ->
+ init:stop(Code),
+ timer:sleep(infinity).
+
invoke(Options, Actions) ->
case Actions of
[] ->
@@ -174,7 +178,7 @@ script_name() ->
fatal_error(String, Code) ->
io:format(standard_error, "~s: ~s\n", [script_name(), String]),
- erlang:halt(Code).
+ safe_stop(Code).
write_file(File, IoList) ->
case file:write_file(File, IoList) of