Skip to content

Commit

Permalink
Skip erlang:halt/1 workaround if >=R15B01
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuncer Ayaz committed Mar 27, 2012
1 parent 769160a commit 3f14c1c
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/rebar_utils.erl
Expand Up @@ -293,14 +293,23 @@ deprecated(Old, New, When) ->

-spec delayed_halt(integer()) -> no_return().
delayed_halt(Code) ->
case os:type() of
{win32, nt} ->
timer:sleep(100),
%% 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);
_ ->
halt(Code),
%% workaround to delay exit until all output is written
receive after infinity -> ok end
false ->
case os:type() of
{win32, nt} ->
timer:sleep(100),
halt(Code);
_ ->
halt(Code),
%% workaround to delay exit until all output is written
receive after infinity -> ok end
end
end.

%% ====================================================================
Expand Down

0 comments on commit 3f14c1c

Please sign in to comment.