summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-03-27 12:48:34 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-03-27 14:19:54 +0200
commit3f14c1c0927dbf90969b35d4c29305c2108f4e9b (patch)
tree8623aa76343db4a7162053798987fa3a4a1f91e9
parent769160ac368ee95892d2dec07e4e675af7ef64d6 (diff)
Skip erlang:halt/1 workaround if >=R15B01
-rw-r--r--src/rebar_utils.erl23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl
index bb05597..a3c8b9b 100644
--- a/src/rebar_utils.erl
+++ b/src/rebar_utils.erl
@@ -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.
%% ====================================================================