diff options
| author | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-05-31 10:52:23 +0200 | 
|---|---|---|
| committer | Tuncer Ayaz <tuncer.ayaz@gmail.com> | 2011-05-31 10:52:23 +0200 | 
| commit | 70137292e199f86f9470822a9234b641844bab1a (patch) | |
| tree | 125de2b7df0e7774a00480a6c8184ca282bfe906 | |
| parent | 0bbb2985f069c2c1785d33da6887598673cdaaac (diff) | |
Extract code to get wordsize into helper function
| -rw-r--r-- | src/rebar_port_compiler.erl | 9 | ||||
| -rw-r--r-- | src/rebar_utils.erl | 18 | 
2 files changed, 12 insertions, 15 deletions
| diff --git a/src/rebar_port_compiler.erl b/src/rebar_port_compiler.erl index ad1e387..3154738 100644 --- a/src/rebar_port_compiler.erl +++ b/src/rebar_port_compiler.erl @@ -398,14 +398,7 @@ default_env() ->       {"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"},       {"darwin", "DRV_LDFLAGS",        "-bundle -flat_namespace -undefined suppress $ERL_LDFLAGS"}, -     {"ERLANG_ARCH", -      try erlang:system_info({wordsize, external}) of -          Val -> -              integer_to_list(8 * Val) -      catch -          error:badarg -> -              integer_to_list(8 * erlang:system_info(wordsize)) -      end}, +     {"ERLANG_ARCH", rebar_utils:wordsize()},       {"ERLANG_TARGET", rebar_utils:get_arch()},       %% Solaris specific flags diff --git a/src/rebar_utils.erl b/src/rebar_utils.erl index 68ca0dc..ebf6656 100644 --- a/src/rebar_utils.erl +++ b/src/rebar_utils.erl @@ -29,6 +29,7 @@  -export([get_cwd/0,           is_arch/1,           get_arch/0, +         wordsize/0,           sh/2,           find_files/2,           now_str/0, @@ -62,16 +63,19 @@ is_arch(ArchRegex) ->      end.  get_arch() -> -    Words = try erlang:system_info({wordsize, external}) of -                Val -> -                    integer_to_list(8 * Val) -            catch -                error:badarg -> -                    integer_to_list(8 * erlang:system_info(wordsize)) -            end, +    Words = wordsize(),      erlang:system_info(otp_release) ++ "-"          ++ erlang:system_info(system_architecture) ++ "-" ++ Words. +wordsize() -> +    try erlang:system_info({wordsize, external}) of +        Val -> +            integer_to_list(8 * Val) +    catch +        error:badarg -> +            integer_to_list(8 * erlang:system_info(wordsize)) +    end. +  %%  %% Options = [Option] -- defaults to [use_stdout, abort_on_error]  %% Option = ErrorOption | OutputOption | {cd, string()} | {env, Env} | 
