diff options
author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2012-01-13 20:03:13 +0100 |
---|---|---|
committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2012-02-16 19:17:58 +0100 |
commit | da122b3e57e13c9935d115ad5b9f62c68121c08a (patch) | |
tree | b6ee0947b1224c3a6b0e679037a9450dae2c50a4 | |
parent | dd22eb48143c4ec6717972fb926d215637f05744 (diff) |
Add rebar_utils:delayed_halt/1
-rw-r--r-- | dialyzer_reference | 2 | ||||
-rw-r--r-- | src/rebar.erl | 4 | ||||
-rw-r--r-- | src/rebar_utils.erl | 17 | ||||
-rw-r--r-- | xref_reference | 2 |
4 files changed, 18 insertions, 7 deletions
diff --git a/dialyzer_reference b/dialyzer_reference index 2125ee2..885d538 100644 --- a/dialyzer_reference +++ b/dialyzer_reference @@ -1,2 +1,2 @@ -rebar_utils.erl:151: Call to missing or unexported function escript:foldl/3 +rebar_utils.erl:152: Call to missing or unexported function escript:foldl/3 diff --git a/src/rebar.erl b/src/rebar.erl index b7d977f..1f72a4c 100644 --- a/src/rebar.erl +++ b/src/rebar.erl @@ -238,9 +238,7 @@ show_info_maybe_halt(O, Opts, F) -> case proplists:get_bool(O, Opts) of true -> F(), - halt(0), - %% workaround to delay exit until all output is written - receive after infinity -> ok end; + rebar_utils:delayed_halt(0); false -> false end. diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 199acdf..eafcf0e 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -45,7 +45,8 @@ deprecated/3, deprecated/4, expand_env_variable/3, vcs_vsn/2, - get_deprecated_global/3]). + get_deprecated_global/3, + delayed_halt/1]). -include("rebar.hrl"). @@ -137,7 +138,7 @@ ensure_dir(Path) -> -spec abort(string(), [term()]) -> no_return(). abort(String, Args) -> ?ERROR(String, Args), - halt(1). + delayed_halt(1). %% TODO: Rename emulate_escript_foldl to escript_foldl and remove %% this function when the time is right. escript:foldl/3 was an @@ -270,6 +271,18 @@ deprecated(Old, New, When) -> "'~p' will be removed ~s.~n~n">>, [Old, Old, New, Old, When]). +-spec delayed_halt(integer()) -> no_return(). +delayed_halt(Code) -> + 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. + %% ==================================================================== %% Internal functions %% ==================================================================== diff --git a/xref_reference b/xref_reference index 8a040b8..8013131 100644 --- a/xref_reference +++ b/xref_reference @@ -1,2 +1,2 @@ ==> rebar (xref) -src/rebar_utils.erl:145: Warning escript_foldl/3 calls undefined function escript:foldl/3 +src/rebar_utils.erl:146: Warning escript_foldl/3 calls undefined function escript:foldl/3 |