11-module (elixir_compiler ).
2- -export ([get_opts /0 , get_opt /1 , get_opt /2 , string /2 , file /1 , file_to_path /2 ]).
2+ -export ([get_opts /0 , get_opt /1 , get_opt /2 , string /2 , file /1 , file_to_path /2 , get_timeout / 0 ]).
33-export ([core /0 , module /3 , eval_forms /4 ]).
44-include (" elixir.hrl" ).
55-compile ({parse_transform , elixir_transform }).
@@ -16,8 +16,14 @@ get_opt(Key, Dict) ->
1616 { Key , Value } -> Value
1717 end .
1818
19+ get_timeout () ->
20+ case application :get_env (elixir , system_services_timeout ) of
21+ {ok , Val } -> Val ;
22+ undefined -> 60000
23+ end .
24+
1925get_opts () ->
20- gen_server :call (elixir_code_server , compiler_options ).
26+ gen_server :call (elixir_code_server , compiler_options , get_timeout () ).
2127
2228% % Compiles the given string.
2329
@@ -107,7 +113,7 @@ module(Forms, File, Options, Bootstrap, Callback) when
107113
108114core () ->
109115 application :start (elixir ),
110- gen_server :call (elixir_code_server , { compiler_options , [{docs ,false },{internal ,true }] }),
116+ gen_server :call (elixir_code_server , { compiler_options , [{docs ,false },{internal ,true }] }, get_timeout () ),
111117 [core_file (File ) || File <- core_main ()].
112118
113119% % HELPERS
@@ -139,7 +145,7 @@ module_form(Fun, Exprs, Line, File, Module, Vars) when
139145% % Generate module names from code server.
140146
141147retrieve_module_name () ->
142- gen_server :call (elixir_code_server , retrieve_module_name ).
148+ gen_server :call (elixir_code_server , retrieve_module_name , get_timeout () ).
143149
144150return_module_name (I ) ->
145151 gen_server :cast (elixir_code_server , { return_module_name , I }).
@@ -207,4 +213,4 @@ format_errors(File, Errors) ->
207213format_warnings (Bootstrap , File , Warnings ) ->
208214 lists :foreach (fun ({_ , Each }) ->
209215 lists :foreach (fun (Warning ) -> elixir_errors :handle_file_warning (Bootstrap , File , Warning ) end , Each )
210- end , Warnings ).
216+ end , Warnings ).
0 commit comments