Skip erlang:halt/1 workaround if >=R15B01

This commit is contained in:
Tuncer Ayaz 2012-03-27 12:48:34 +02:00
parent 769160ac36
commit 3f14c1c092

View file

@ -293,6 +293,14 @@ deprecated(Old, New, When) ->
-spec delayed_halt(integer()) -> no_return(). -spec delayed_halt(integer()) -> no_return().
delayed_halt(Code) -> delayed_halt(Code) ->
%% Work around buffer flushing issue in erlang:halt if OTP older
%% than R15B01.
%% TODO: remove workaround once we require R15B01 or newer
%% R15B01 introduced erlang:halt/2
case erlang:is_builtin(erlang, halt, 2) of
true ->
halt(Code);
false ->
case os:type() of case os:type() of
{win32, nt} -> {win32, nt} ->
timer:sleep(100), timer:sleep(100),
@ -301,6 +309,7 @@ delayed_halt(Code) ->
halt(Code), halt(Code),
%% workaround to delay exit until all output is written %% workaround to delay exit until all output is written
receive after infinity -> ok end receive after infinity -> ok end
end
end. end.
%% ==================================================================== %% ====================================================================